Test updates

Signed-off-by: Eric Voshall <6836155+ericvoshall@users.noreply.github.com>
This commit is contained in:
Eric Voshall
2022-05-10 11:10:34 -04:00
parent b275c631b7
commit 64e83f3cb6
5 changed files with 12 additions and 16 deletions
+1 -1
View File
@@ -8,6 +8,6 @@ Accessibility updates:
- Added `aria-label` to the `Select` component in `core-components`
- Changed heading level used in the header of `Table` component in `core-components`
- Added screenreader elements to describe default table `Action` buttons in `plugin-catalog`
- Added screen reader elements to describe default table `Action` buttons in `plugin-catalog`
- Wrapped the `EntityLifecyclePicker`, `EntityOwnerPicker`, `EntityTagPicker`, in `label` elements in `plugin-catalog-react`
- Changed group name `Typography` component to `span` (from default `h6`), added `aria-label` to the `List` component, and `role` of `menuitem` to the container of the `MenuItem` component in `plugin-catalog-react`
@@ -167,7 +167,7 @@ describe('<UserListPicker />', () => {
expect(
getAllByRole('menuitem').map(({ textContent }) => textContent),
).toEqual(['Owned', 'Starred', 'All']);
).toEqual(['Owned 1', 'Starred 1', 'All 4']);
});
it('includes counts alongside each filter', async () => {
@@ -183,10 +183,8 @@ describe('<UserListPicker />', () => {
// menuitem itself, so we pick off the next sibling.
await waitFor(() => {
expect(
getAllByRole('menuitem').map(
({ nextSibling }) => nextSibling?.textContent,
),
).toEqual(['1', '1', '4']);
getAllByRole('menuitem').map(({ textContent }) => textContent),
).toEqual(['Owned 1', 'Starred 1', 'All 4']);
});
});
@@ -206,10 +204,8 @@ describe('<UserListPicker />', () => {
await waitFor(() => {
expect(
getAllByRole('menuitem').map(
({ nextSibling }) => nextSibling?.textContent,
),
).toEqual(['1', '0', '2']);
getAllByRole('menuitem').map(({ textContent }) => textContent),
).toEqual(['Owned 1', 'Starred 0', 'All 2']);
});
});
@@ -267,7 +267,7 @@ export const UserListPicker = (props: UserListPickerProps) => {
</ListItemIcon>
)}
<ListItemText>
<Typography variant="body1">{item.label}</Typography>
<Typography variant="body1">{item.label} </Typography>
</ListItemText>
<ListItemSecondaryAction>
{filterCounts[item.id] ?? '-'}
@@ -121,7 +121,7 @@ export const CatalogTable = (props: CatalogTableProps) => {
return {
icon: () => (
<>
<Typography variant="srOnly" title={title} />
<Typography variant="srOnly">{title}</Typography>
<OpenInNew fontSize="small" />
</>
),
@@ -140,7 +140,7 @@ export const CatalogTable = (props: CatalogTableProps) => {
return {
icon: () => (
<>
<Typography variant="srOnly" title={title} />
<Typography variant="srOnly">{title}</Typography>
<Edit fontSize="small" />
</>
),
@@ -160,7 +160,7 @@ export const CatalogTable = (props: CatalogTableProps) => {
cellStyle: { paddingLeft: '1em' },
icon: () => (
<>
<Typography variant="srOnly" title={title} />
<Typography variant="srOnly">{title}</Typography>
{isStarred ? <YellowStar /> : <StarBorder />}
</>
),
@@ -88,8 +88,8 @@ describe('TemplateListPage', () => {
{ mountedRoutes: { '/': rootRouteRef } },
);
expect(getByRole('menuitem', { name: 'All' })).toBeInTheDocument();
expect(getByRole('menuitem', { name: 'Starred' })).toBeInTheDocument();
expect(getByRole('menuitem', { name: 'All 0' })).toBeInTheDocument();
expect(getByRole('menuitem', { name: 'Starred 0' })).toBeInTheDocument();
});
it('should render the category picker', async () => {