-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
13de30d
commit 609370b
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
packages/react-table/src/components/Table/__tests__/Th.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import * as React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { Th } from '../Th'; | ||
|
||
test('Does not render with aria-label by default', () => { | ||
render(<Th />); | ||
expect(screen.getByRole('columnheader')).not.toHaveAccessibleName(); | ||
}); | ||
|
||
test('Renders with aria-label when passed in', () => { | ||
render(<Th aria-label="Test" />); | ||
expect(screen.getByRole('columnheader')).toHaveAccessibleName('Test'); | ||
}); | ||
|
||
test('Does not render with screen reader text by default', () => { | ||
render(<Th />); | ||
|
||
expect(screen.getByRole('columnheader')).toBeEmptyDOMElement(); | ||
}); | ||
|
||
test('Does not render with screen reader text when children are passed in', () => { | ||
render(<Th screenReaderText="Test">Heading label</Th>); | ||
|
||
expect(screen.getByRole('columnheader')).not.toHaveTextContent('Test'); | ||
}); | ||
|
||
test('Renders with screen reader text when screenReaderText is passed in', () => { | ||
render(<Th screenReaderText="Test" />); | ||
|
||
expect(screen.getByRole('columnheader')).toHaveTextContent('Test'); | ||
}); |