Add more accessibility tests

This commit is contained in:
Alejandro Celaya
2023-09-30 10:45:52 +02:00
parent 6d1d3c021a
commit 7a216a195a
29 changed files with 117 additions and 33 deletions

View File

@@ -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('<RealTimeUpdatesSettings />', () => {
@@ -15,6 +16,8 @@ describe('<RealTimeUpdatesSettings />', () => {
/>,
);
it('passes a11y checks', () => checkAccessibility(setUp()));
it('renders enabled real time updates as expected', () => {
setUp({ enabled: true });

View File

@@ -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('<Settings />', () => {
const Settings = SettingsFactory(fromPartial({
@@ -19,6 +20,8 @@ describe('<Settings />', () => {
return render(<Router location={history.location} navigator={history}><Settings /></Router>);
};
it('passes a11y checks', () => checkAccessibility(setUp()));
it.each([
['/general', {
visibleComps: ['UserInterface', 'RealTimeUpdates'],

View File

@@ -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('<ShortUrlCreationSettings />', () => {
@@ -13,6 +14,8 @@ describe('<ShortUrlCreationSettings />', () => {
/>,
);
it('passes a11y checks', () => checkAccessibility(setUp()));
it.each([
[{ validateUrls: true }, true],
[{ validateUrls: false }, false],

View File

@@ -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('<ShortUrlsListSettings />', () => {
@@ -10,6 +11,8 @@ describe('<ShortUrlsListSettings />', () => {
<ShortUrlsListSettings settings={fromPartial({ shortUrlsList })} setShortUrlsListSettings={setSettings} />,
);
it('passes a11y checks', () => checkAccessibility(setUp()));
it.each([
[undefined, 'Order by: Created at - DESC'],
[fromPartial<ShortUrlsSettings>({}), 'Order by: Created at - DESC'],

View File

@@ -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('<TagsSettings />', () => {
@@ -11,6 +12,8 @@ describe('<TagsSettings />', () => {
<TagsSettings settings={fromPartial({ tags })} setTagsSettings={setTagsSettings} />,
);
it('passes a11y checks', () => checkAccessibility(setUp()));
it('renders expected amount of groups', () => {
setUp();

View File

@@ -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('<UserInterfaceSettings />', () => {
@@ -11,6 +12,8 @@ describe('<UserInterfaceSettings />', () => {
<UserInterfaceSettings settings={fromPartial({ ui })} setUiSettings={setUiSettings} />,
);
it('passes a11y checks', () => checkAccessibility(setUp()));
it.each([
[{ theme: 'dark' as Theme }, true],
[{ theme: 'light' as Theme }, false],

View File

@@ -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('<VisitsSettings />', () => {
@@ -10,6 +11,8 @@ describe('<VisitsSettings />', () => {
<VisitsSettings settings={fromPartial(settings)} setVisitsSettings={setVisitsSettings} />,
);
it('passes a11y checks', () => checkAccessibility(setUp()));
it('renders expected components', () => {
setUp();