diff --git a/package-lock.json b/package-lock.json index 9525711a..451000fa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "@fortawesome/react-fontawesome": "^0.2.0", "@json2csv/plainjs": "^7.0.3", "@reduxjs/toolkit": "^1.9.5", - "@shlinkio/shlink-frontend-kit": "^0.3.0", + "@shlinkio/shlink-frontend-kit": "^0.4.0", "@shlinkio/shlink-js-sdk": "^0.1.0", "@shlinkio/shlink-web-component": "^0.3.4", "bootstrap": "5.2.3", @@ -2802,13 +2802,13 @@ } }, "node_modules/@shlinkio/shlink-frontend-kit": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@shlinkio/shlink-frontend-kit/-/shlink-frontend-kit-0.3.0.tgz", - "integrity": "sha512-MjftbQKc+Vq2rGsjsTQHcnq4IFSjaazBZ82T/TSEz9wza/y/Siy7bBQlTdALyaHW+FT0Lv5nOf/V5RH+iotsCA==", + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@shlinkio/shlink-frontend-kit/-/shlink-frontend-kit-0.4.0.tgz", + "integrity": "sha512-Z9GqIqc6iHGMs9GHEQ+ERv5NfdvnoReHJbz5WPgXMlVT0s5ooL7s0hdsR/zgppLVF0r8HsKLXKlKR8bMY8B22g==", "dependencies": { "classnames": "^2.3.2", "qs": "^6.11.2", - "uuid": "^9.0.0" + "uuid": "^9.0.1" }, "peerDependencies": { "@fortawesome/fontawesome-free": "^6.4.2", @@ -12420,13 +12420,13 @@ } }, "@shlinkio/shlink-frontend-kit": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@shlinkio/shlink-frontend-kit/-/shlink-frontend-kit-0.3.0.tgz", - "integrity": "sha512-MjftbQKc+Vq2rGsjsTQHcnq4IFSjaazBZ82T/TSEz9wza/y/Siy7bBQlTdALyaHW+FT0Lv5nOf/V5RH+iotsCA==", + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@shlinkio/shlink-frontend-kit/-/shlink-frontend-kit-0.4.0.tgz", + "integrity": "sha512-Z9GqIqc6iHGMs9GHEQ+ERv5NfdvnoReHJbz5WPgXMlVT0s5ooL7s0hdsR/zgppLVF0r8HsKLXKlKR8bMY8B22g==", "requires": { "classnames": "^2.3.2", "qs": "^6.11.2", - "uuid": "^9.0.0" + "uuid": "^9.0.1" } }, "@shlinkio/shlink-js-sdk": { diff --git a/package.json b/package.json index 995cd191..2a00c980 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "@fortawesome/react-fontawesome": "^0.2.0", "@json2csv/plainjs": "^7.0.3", "@reduxjs/toolkit": "^1.9.5", - "@shlinkio/shlink-frontend-kit": "^0.3.0", + "@shlinkio/shlink-frontend-kit": "^0.4.0", "@shlinkio/shlink-js-sdk": "^0.1.0", "@shlinkio/shlink-web-component": "^0.3.4", "bootstrap": "5.2.3", diff --git a/src/servers/ManageServers.tsx b/src/servers/ManageServers.tsx index 067632d9..5b38cc73 100644 --- a/src/servers/ManageServers.tsx +++ b/src/servers/ManageServers.tsx @@ -70,10 +70,10 @@ const ManageServers: FCWithDeps = ({ serv - {hasAutoConnect && } - diff --git a/src/servers/ManageServersRowDropdown.tsx b/src/servers/ManageServersRowDropdown.tsx index 3b106045..e9e1c9db 100644 --- a/src/servers/ManageServersRowDropdown.tsx +++ b/src/servers/ManageServersRowDropdown.tsx @@ -47,7 +47,7 @@ const ManageServersRowDropdown: FCWithDeps setAutoConnect(server, !isAutoConnect)}> {isAutoConnect ? 'Do not a' : 'A'}uto-connect - + Remove server diff --git a/src/servers/ServersDropdown.tsx b/src/servers/ServersDropdown.tsx index 934e8206..0265c610 100644 --- a/src/servers/ServersDropdown.tsx +++ b/src/servers/ServersDropdown.tsx @@ -30,7 +30,7 @@ export const ServersDropdown = ({ servers, selectedServer }: ServersDropdownProp {name} ))} - + Manage servers diff --git a/src/servers/ServersListGroup.tsx b/src/servers/ServersListGroup.tsx index 16dd7fd5..5a5b2574 100644 --- a/src/servers/ServersListGroup.tsx +++ b/src/servers/ServersListGroup.tsx @@ -21,9 +21,10 @@ const ServerListItem = ({ id, name }: { id: string; name: string }) => ( export const ServersListGroup: FC = ({ servers, children, embedded = false }) => ( <> - {children &&
{children}
} + {children &&
{children}
} {servers.length > 0 && ( diff --git a/src/servers/helpers/ImportServersBtn.tsx b/src/servers/helpers/ImportServersBtn.tsx index 132c8520..d93688df 100644 --- a/src/servers/helpers/ImportServersBtn.tsx +++ b/src/servers/helpers/ImportServersBtn.tsx @@ -88,7 +88,7 @@ const ImportServersBtn: FCWithDepsname, apiKey and url columns. - + ; export const checkAccessibility = async (subject: AccessibilityTestSubject) => { const { container } = await subject; - screen.debug(container); const { violations } = await run(container); expect(violations).toStrictEqual([]); diff --git a/test/servers/CreateServer.test.tsx b/test/servers/CreateServer.test.tsx index 70693636..5a7d6256 100644 --- a/test/servers/CreateServer.test.tsx +++ b/test/servers/CreateServer.test.tsx @@ -3,6 +3,7 @@ import { fromPartial } from '@total-typescript/shoehorn'; import { useNavigate } from 'react-router-dom'; import { CreateServerFactory } from '../../src/servers/CreateServer'; import type { ServersMap } from '../../src/servers/data'; +import { checkAccessibility } from '../__helpers__/accessibility'; import { renderWithEvents } from '../__helpers__/setUpTest'; vi.mock('react-router-dom', async () => ({ @@ -39,6 +40,8 @@ describe('', () => { return renderWithEvents(); }; + it('passes a11y checks', () => checkAccessibility(setUp())); + it('shows success message when imported is true', () => { setUp({ serversImported: true }); diff --git a/test/servers/DeleteServerButton.test.tsx b/test/servers/DeleteServerButton.test.tsx index a9e188e7..e67217bc 100644 --- a/test/servers/DeleteServerButton.test.tsx +++ b/test/servers/DeleteServerButton.test.tsx @@ -3,6 +3,7 @@ import { fromPartial } from '@total-typescript/shoehorn'; import type { ReactNode } from 'react'; import { DeleteServerButtonFactory } from '../../src/servers/DeleteServerButton'; import type { DeleteServerModalProps } from '../../src/servers/DeleteServerModal'; +import { checkAccessibility } from '../__helpers__/accessibility'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { @@ -13,6 +14,8 @@ describe('', () => { {children}, ); + it('passes a11y checks', () => checkAccessibility(setUp('Delete me'))); + it.each([ ['Foo bar'], ['baz'], diff --git a/test/servers/DeleteServerModal.test.tsx b/test/servers/DeleteServerModal.test.tsx index c2f7b334..2af0fe63 100644 --- a/test/servers/DeleteServerModal.test.tsx +++ b/test/servers/DeleteServerModal.test.tsx @@ -2,6 +2,7 @@ import { screen, waitFor } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import { useNavigate } from 'react-router-dom'; import { DeleteServerModal } from '../../src/servers/DeleteServerModal'; +import { checkAccessibility } from '../__helpers__/accessibility'; import { renderWithEvents } from '../__helpers__/setUpTest'; import { TestModalWrapper } from '../__helpers__/TestModalWrapper'; @@ -30,6 +31,8 @@ describe('', () => { ); }; + it('passes a11y checks', () => checkAccessibility(setUp())); + it('renders a modal window', () => { setUp(); diff --git a/test/servers/EditServer.test.tsx b/test/servers/EditServer.test.tsx index f3c379c7..640505cc 100644 --- a/test/servers/EditServer.test.tsx +++ b/test/servers/EditServer.test.tsx @@ -3,6 +3,7 @@ import { fromPartial } from '@total-typescript/shoehorn'; import { MemoryRouter, useNavigate } from 'react-router-dom'; import type { ReachableServer, SelectedServer } from '../../src/servers/data'; import { EditServerFactory } from '../../src/servers/EditServer'; +import { checkAccessibility } from '../__helpers__/accessibility'; import { renderWithEvents } from '../__helpers__/setUpTest'; vi.mock('react-router-dom', async () => ({ @@ -31,6 +32,8 @@ describe('', () => { (useNavigate as any).mockReturnValue(navigate); }); + it('passes a11y checks', () => checkAccessibility(setUp())); + it('renders nothing if selected server is not reachable', () => { setUp(fromPartial({})); diff --git a/test/servers/ManageServers.test.tsx b/test/servers/ManageServers.test.tsx index 7a87f49f..6ed23b7d 100644 --- a/test/servers/ManageServers.test.tsx +++ b/test/servers/ManageServers.test.tsx @@ -4,6 +4,7 @@ import { MemoryRouter } from 'react-router-dom'; import type { ServersMap, ServerWithId } from '../../src/servers/data'; import { ManageServersFactory } from '../../src/servers/ManageServers'; import type { ServersExporter } from '../../src/servers/services/ServersExporter'; +import { checkAccessibility } from '../__helpers__/accessibility'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { @@ -25,6 +26,12 @@ describe('', () => { , ); + it('passes a11y checks', () => checkAccessibility(setUp({ + foo: createServerMock('foo'), + bar: createServerMock('bar'), + baz: createServerMock('baz'), + }))); + it('shows search field which allows searching servers, affecting te amount of rendered rows', async () => { const { user } = setUp({ foo: createServerMock('foo'), diff --git a/test/servers/ManageServersRow.test.tsx b/test/servers/ManageServersRow.test.tsx index e9160c4e..7446938f 100644 --- a/test/servers/ManageServersRow.test.tsx +++ b/test/servers/ManageServersRow.test.tsx @@ -3,6 +3,7 @@ import { fromPartial } from '@total-typescript/shoehorn'; import { MemoryRouter } from 'react-router-dom'; import type { ServerWithId } from '../../src/servers/data'; import { ManageServersRowFactory } from '../../src/servers/ManageServersRow'; +import { checkAccessibility } from '../__helpers__/accessibility'; describe('', () => { const ManageServersRow = ManageServersRowFactory(fromPartial({ @@ -24,6 +25,8 @@ describe('', () => { , ); + it('passes a11y checks', () => checkAccessibility(setUp())); + it.each([ [true, 4], [false, 3], diff --git a/test/servers/ManageServersRowDropdown.test.tsx b/test/servers/ManageServersRowDropdown.test.tsx index e9aa93b1..88f11ef8 100644 --- a/test/servers/ManageServersRowDropdown.test.tsx +++ b/test/servers/ManageServersRowDropdown.test.tsx @@ -1,8 +1,10 @@ import { screen } from '@testing-library/react'; +import type { UserEvent } from '@testing-library/user-event'; import { fromPartial } from '@total-typescript/shoehorn'; import { MemoryRouter } from 'react-router-dom'; import type { ServerWithId } from '../../src/servers/data'; import { ManageServersRowDropdownFactory } from '../../src/servers/ManageServersRowDropdown'; +import { checkAccessibility } from '../__helpers__/accessibility'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { @@ -20,12 +22,23 @@ describe('', () => { , ); }; + const toggleDropdown = (user: UserEvent) => user.click(screen.getByRole('button')); + + it.each([ + [setUp], + [async () => { + const { user, container } = setUp(); + await toggleDropdown(user); + + return { container }; + }], + ])('passes a11y checks', (setUp) => checkAccessibility(setUp())); it('renders expected amount of dropdown items', async () => { const { user } = setUp(); expect(screen.queryByRole('menu')).not.toBeInTheDocument(); - await user.click(screen.getByRole('button')); + await toggleDropdown(user); expect(screen.getByRole('menu')).toBeInTheDocument(); expect(screen.getAllByRole('menuitem')).toHaveLength(4); @@ -37,7 +50,7 @@ describe('', () => { const { user } = setUp(); expect(setAutoConnect).not.toHaveBeenCalled(); - await user.click(screen.getByRole('button')); + await toggleDropdown(user); await user.click(screen.getByRole('menuitem', { name: 'Auto-connect' })); expect(setAutoConnect).toHaveBeenCalledWith(expect.objectContaining({ id: 'abc123' }), true); }); @@ -48,7 +61,7 @@ describe('', () => { expect(screen.queryByText('DeleteServerModal [OPEN]')).not.toBeInTheDocument(); expect(screen.getByText('DeleteServerModal [CLOSED]')).toBeInTheDocument(); - await user.click(screen.getByRole('button')); + await toggleDropdown(user); await user.click(screen.getByRole('menuitem', { name: 'Remove server' })); expect(screen.getByText('DeleteServerModal [OPEN]')).toBeInTheDocument(); diff --git a/test/servers/ServersDropdown.test.tsx b/test/servers/ServersDropdown.test.tsx index c78ed5f6..c1a2e548 100644 --- a/test/servers/ServersDropdown.test.tsx +++ b/test/servers/ServersDropdown.test.tsx @@ -4,6 +4,7 @@ import { values } from 'ramda'; import { MemoryRouter } from 'react-router-dom'; import type { ServersMap } from '../../src/servers/data'; import { ServersDropdown } from '../../src/servers/ServersDropdown'; +import { checkAccessibility } from '../__helpers__/accessibility'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { @@ -13,9 +14,15 @@ describe('', () => { '3c': fromPartial({ name: 'baz', id: '3c' }), }; const setUp = (servers: ServersMap = fallbackServers) => renderWithEvents( - , + +
    + +
+
, ); + it('passes a11y checks', () => checkAccessibility(setUp())); + it('contains the list of servers and the "mange servers" button', async () => { const { user } = setUp(); diff --git a/test/servers/ServersListGroup.test.tsx b/test/servers/ServersListGroup.test.tsx index d99f68e0..3cce37b1 100644 --- a/test/servers/ServersListGroup.test.tsx +++ b/test/servers/ServersListGroup.test.tsx @@ -3,13 +3,14 @@ import { fromPartial } from '@total-typescript/shoehorn'; import { MemoryRouter } from 'react-router-dom'; import type { ServerWithId } from '../../src/servers/data'; import { ServersListGroup } from '../../src/servers/ServersListGroup'; +import { checkAccessibility } from '../__helpers__/accessibility'; describe('', () => { const servers: ServerWithId[] = [ fromPartial({ name: 'foo', id: '123' }), fromPartial({ name: 'bar', id: '456' }), ]; - const setUp = (params: { servers?: ServerWithId[]; withChildren?: boolean; embedded?: boolean }) => { + const setUp = (params: { servers?: ServerWithId[]; withChildren?: boolean; embedded?: boolean } = {}) => { const { servers = [], withChildren = true, embedded } = params; return render( @@ -21,14 +22,16 @@ describe('', () => { ); }; + it('passes a11y checks', () => checkAccessibility(setUp())); + it('renders title', () => { setUp({}); - expect(screen.getByRole('heading')).toHaveTextContent('The list of servers'); + expect(screen.getByTestId('title')).toHaveTextContent('The list of servers'); }); it('does not render title when children is not provided', () => { setUp({ withChildren: false }); - expect(screen.queryByRole('heading')).not.toBeInTheDocument(); + expect(screen.queryByTestId('title')).not.toBeInTheDocument(); }); it.each([ @@ -37,7 +40,7 @@ describe('', () => { ])('shows servers list', (servers) => { setUp({ servers }); - expect(screen.queryAllByRole('list')).toHaveLength(servers.length ? 1 : 0); + expect(screen.queryAllByTestId('list')).toHaveLength(servers.length ? 1 : 0); expect(screen.queryAllByRole('link')).toHaveLength(servers.length); }); @@ -47,6 +50,6 @@ describe('', () => { [undefined, 'servers-list__list-group'], ])('renders proper classes for embedded', (embedded, expectedClasses) => { setUp({ servers, embedded }); - expect(screen.getByRole('list')).toHaveAttribute('class', `${expectedClasses} list-group`); + expect(screen.getByTestId('list')).toHaveAttribute('class', `${expectedClasses} list-group`); }); }); diff --git a/test/servers/helpers/DuplicatedServersModal.test.tsx b/test/servers/helpers/DuplicatedServersModal.test.tsx index 807728c1..7c838701 100644 --- a/test/servers/helpers/DuplicatedServersModal.test.tsx +++ b/test/servers/helpers/DuplicatedServersModal.test.tsx @@ -2,6 +2,7 @@ import { screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import type { ServerData } from '../../../src/servers/data'; import { DuplicatedServersModal } from '../../../src/servers/helpers/DuplicatedServersModal'; +import { checkAccessibility } from '../../__helpers__/accessibility'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { @@ -12,6 +13,8 @@ describe('', () => { ); const mockServer = (data: Partial = {}) => fromPartial(data); + it('passes a11y checks', () => checkAccessibility(setUp())); + it.each([ [[], 0], [[mockServer()], 2], diff --git a/test/servers/helpers/ImportServersBtn.test.tsx b/test/servers/helpers/ImportServersBtn.test.tsx index 22f9643c..b2ef75d0 100644 --- a/test/servers/helpers/ImportServersBtn.test.tsx +++ b/test/servers/helpers/ImportServersBtn.test.tsx @@ -5,6 +5,7 @@ import type { ImportServersBtnProps } from '../../../src/servers/helpers/ImportServersBtn'; import { ImportServersBtnFactory } from '../../../src/servers/helpers/ImportServersBtn'; import type { ServersImporter } from '../../../src/servers/services/ServersImporter'; +import { checkAccessibility } from '../../__helpers__/accessibility'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { @@ -22,6 +23,8 @@ describe('', () => { />, ); + it('passes a11y checks', () => checkAccessibility(setUp())); + it('shows tooltip on button hover', async () => { const { user } = setUp(); diff --git a/test/servers/helpers/ServerError.test.tsx b/test/servers/helpers/ServerError.test.tsx index cb0e49a4..d15a609c 100644 --- a/test/servers/helpers/ServerError.test.tsx +++ b/test/servers/helpers/ServerError.test.tsx @@ -1,11 +1,22 @@ import { render, screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import { MemoryRouter } from 'react-router-dom'; -import type { NonReachableServer, NotFoundServer } from '../../../src/servers/data'; +import type { NonReachableServer, NotFoundServer, SelectedServer } from '../../../src/servers/data'; import { ServerErrorFactory } from '../../../src/servers/helpers/ServerError'; +import { checkAccessibility } from '../../__helpers__/accessibility'; describe('', () => { const ServerError = ServerErrorFactory(fromPartial({ DeleteServerButton: () => null })); + const setUp = (selectedServer: SelectedServer) => render( + + + , + ); + + it.each([ + [fromPartial({})], + [fromPartial({ id: 'abc123' })], + ])('passes a11y checks', (selectedServer) => checkAccessibility(setUp(selectedServer))); it.each([ [ @@ -31,11 +42,7 @@ describe('', () => { }, ], ])('renders expected information based on provided server type', (selectedServer, { found, notFound }) => { - render( - - - , - ); + setUp(selectedServer); found.forEach((text) => expect(screen.getByText(text)).toBeInTheDocument()); notFound.forEach((text) => expect(screen.queryByText(text)).not.toBeInTheDocument()); diff --git a/test/servers/helpers/ServerForm.test.tsx b/test/servers/helpers/ServerForm.test.tsx index 8373a823..63207f6c 100644 --- a/test/servers/helpers/ServerForm.test.tsx +++ b/test/servers/helpers/ServerForm.test.tsx @@ -1,10 +1,13 @@ import { fireEvent, render, screen } from '@testing-library/react'; import { ServerForm } from '../../../src/servers/helpers/ServerForm'; +import { checkAccessibility } from '../../__helpers__/accessibility'; describe('', () => { const onSubmit = vi.fn(); const setUp = () => render(Something); + it('passes a11y checks', () => checkAccessibility(setUp())); + it('renders components', () => { setUp(); diff --git a/test/settings/RealTimeUpdatesSettings.test.tsx b/test/settings/RealTimeUpdatesSettings.test.tsx index dc3695cb..65bb04d4 100644 --- a/test/settings/RealTimeUpdatesSettings.test.tsx +++ b/test/settings/RealTimeUpdatesSettings.test.tsx @@ -2,6 +2,7 @@ import type { RealTimeUpdatesSettings as RealTimeUpdatesSettingsOptions } from ' import { screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import { RealTimeUpdatesSettings } from '../../src/settings/RealTimeUpdatesSettings'; +import { checkAccessibility } from '../__helpers__/accessibility'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { @@ -15,6 +16,8 @@ describe('', () => { />, ); + it('passes a11y checks', () => checkAccessibility(setUp())); + it('renders enabled real time updates as expected', () => { setUp({ enabled: true }); diff --git a/test/settings/Settings.test.tsx b/test/settings/Settings.test.tsx index 5c2321d0..a35e6af5 100644 --- a/test/settings/Settings.test.tsx +++ b/test/settings/Settings.test.tsx @@ -3,6 +3,7 @@ import { fromPartial } from '@total-typescript/shoehorn'; import { createMemoryHistory } from 'history'; import { Router } from 'react-router-dom'; import { SettingsFactory } from '../../src/settings/Settings'; +import { checkAccessibility } from '../__helpers__/accessibility'; describe('', () => { const Settings = SettingsFactory(fromPartial({ @@ -19,6 +20,8 @@ describe('', () => { return render(); }; + it('passes a11y checks', () => checkAccessibility(setUp())); + it.each([ ['/general', { visibleComps: ['UserInterface', 'RealTimeUpdates'], diff --git a/test/settings/ShortUrlCreationSettings.test.tsx b/test/settings/ShortUrlCreationSettings.test.tsx index fb58cbcb..d33c7726 100644 --- a/test/settings/ShortUrlCreationSettings.test.tsx +++ b/test/settings/ShortUrlCreationSettings.test.tsx @@ -2,6 +2,7 @@ import type { ShortUrlCreationSettings as ShortUrlsSettings } from '@shlinkio/sh import { screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import { ShortUrlCreationSettings } from '../../src/settings/ShortUrlCreationSettings'; +import { checkAccessibility } from '../__helpers__/accessibility'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { @@ -13,6 +14,8 @@ describe('', () => { />, ); + it('passes a11y checks', () => checkAccessibility(setUp())); + it.each([ [{ validateUrls: true }, true], [{ validateUrls: false }, false], diff --git a/test/settings/ShortUrlsListSettings.test.tsx b/test/settings/ShortUrlsListSettings.test.tsx index 71edb21e..02cb5f40 100644 --- a/test/settings/ShortUrlsListSettings.test.tsx +++ b/test/settings/ShortUrlsListSettings.test.tsx @@ -2,6 +2,7 @@ import type { ShortUrlsListSettings as ShortUrlsSettings } from '@shlinkio/shlin import { screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import { ShortUrlsListSettings } from '../../src/settings/ShortUrlsListSettings'; +import { checkAccessibility } from '../__helpers__/accessibility'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { @@ -10,6 +11,8 @@ describe('', () => { , ); + it('passes a11y checks', () => checkAccessibility(setUp())); + it.each([ [undefined, 'Order by: Created at - DESC'], [fromPartial({}), 'Order by: Created at - DESC'], diff --git a/test/settings/TagsSettings.test.tsx b/test/settings/TagsSettings.test.tsx index 55f257cf..b757963e 100644 --- a/test/settings/TagsSettings.test.tsx +++ b/test/settings/TagsSettings.test.tsx @@ -3,6 +3,7 @@ import { screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import type { TagsOrder } from '../../src/settings/TagsSettings'; import { TagsSettings } from '../../src/settings/TagsSettings'; +import { checkAccessibility } from '../__helpers__/accessibility'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { @@ -11,6 +12,8 @@ describe('', () => { , ); + it('passes a11y checks', () => checkAccessibility(setUp())); + it('renders expected amount of groups', () => { setUp(); diff --git a/test/settings/UserInterfaceSettings.test.tsx b/test/settings/UserInterfaceSettings.test.tsx index b0ef7aae..5627f8e7 100644 --- a/test/settings/UserInterfaceSettings.test.tsx +++ b/test/settings/UserInterfaceSettings.test.tsx @@ -3,6 +3,7 @@ import { screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import type { UiSettings } from '../../src/settings/reducers/settings'; import { UserInterfaceSettings } from '../../src/settings/UserInterfaceSettings'; +import { checkAccessibility } from '../__helpers__/accessibility'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { @@ -11,6 +12,8 @@ describe('', () => { , ); + it('passes a11y checks', () => checkAccessibility(setUp())); + it.each([ [{ theme: 'dark' as Theme }, true], [{ theme: 'light' as Theme }, false], diff --git a/test/settings/VisitsSettings.test.tsx b/test/settings/VisitsSettings.test.tsx index 00916120..175dc5ac 100644 --- a/test/settings/VisitsSettings.test.tsx +++ b/test/settings/VisitsSettings.test.tsx @@ -2,6 +2,7 @@ import type { Settings } from '@shlinkio/shlink-web-component'; import { screen } from '@testing-library/react'; import { fromPartial } from '@total-typescript/shoehorn'; import { VisitsSettings } from '../../src/settings/VisitsSettings'; +import { checkAccessibility } from '../__helpers__/accessibility'; import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { @@ -10,6 +11,8 @@ describe('', () => { , ); + it('passes a11y checks', () => checkAccessibility(setUp())); + it('renders expected components', () => { setUp(); diff --git a/test/utils/dates/DateIntervalSelector.test.tsx b/test/utils/dates/DateIntervalSelector.test.tsx index 56c38eaf..343bb555 100644 --- a/test/utils/dates/DateIntervalSelector.test.tsx +++ b/test/utils/dates/DateIntervalSelector.test.tsx @@ -1,6 +1,7 @@ import { screen, waitFor } from '@testing-library/react'; import type { DateInterval } from '../../../src/utils/dates/DateIntervalSelector'; import { DateIntervalSelector, INTERVAL_TO_STRING_MAP } from '../../../src/utils/dates/DateIntervalSelector'; +import { checkAccessibility } from '../../__helpers__/accessibility'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { @@ -10,6 +11,8 @@ describe('', () => { , ); + it('passes a11y checks', () => checkAccessibility(setUp())); + it('passes props down to nested DateIntervalDropdownItems', async () => { const { user } = setUp(); const btn = screen.getByRole('button');
} + {hasAutoConnect && Auto-connectName Base URL + Options