Skip to content

Commit

Permalink
Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
milofultz committed Dec 15, 2023
1 parent 978e4fb commit 3d61040
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/pages/CivicProfile.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ import { render } from '@testing-library/react';
import { expect, it } from 'vitest';
import { CivicProfile } from '@pages';
import createMatchMedia from '../helpers/createMatchMedia';
import isAccessible from '../utils/axe';

// TODO: Fix accessibility issues with this component
it.skip('should be accessible', () => {
isAccessible(
render(
<BrowserRouter>
<CivicProfile />
</BrowserRouter>
)
);
});

it('renders page container flex direction as row and nav container width as 25% by default', () => {
const component = render(
Expand Down
27 changes: 27 additions & 0 deletions test/pages/Contacts.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { render } from '@testing-library/react';
import { useContactsList } from '@hooks';
import { BrowserRouter } from 'react-router-dom';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import isAccessible from '../utils/axe';

vi.mock('@hooks', async () => {
const actual = await vi.importActual('@hooks');
Expand All @@ -22,6 +23,32 @@ describe('Contacts Page', () => {
vi.clearAllMocks();
});

// TODO: Fix accessibility issues with this component
it.skip('should be accessible', () => {
const firstContact = {
person: 'Peter Parker',
familyName: 'Parker',
givenName: 'Peter',
webId: 'http://peter.com'
};
const secondContact = {
person: 'Batman',
familyName: 'Batman',
givenName: 'Batman',
webId: 'http://batman.com'
};
useContactsList.mockReturnValue({ data: [firstContact, secondContact] });
isAccessible(
render(
<QueryClientProvider client={queryClient}>
<BrowserRouter>
<Contacts />
</BrowserRouter>
</QueryClientProvider>
)
);
});

it('displays Loading message while loading', () => {
useContactsList.mockReturnValue({ isLoading: true });
const { getByRole } = render(
Expand Down
5 changes: 5 additions & 0 deletions test/pages/Home.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ import { render, cleanup, screen } from '@testing-library/react';
import { expect, describe, it, afterEach } from 'vitest';
import { Home } from '@pages';
import createMatchMedia from '../helpers/createMatchMedia';
import isAccessible from '../utils/axe';

describe('Home Page', () => {
afterEach(cleanup);

it('should be accessible', () => {
isAccessible(render(<Home />));
});

it('renders with correct order of logoSection on mobile', () => {
window.matchMedia = createMatchMedia(599);
render(<Home />);
Expand Down
12 changes: 12 additions & 0 deletions test/pages/PersonalProfile.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,22 @@ import { BrowserRouter } from 'react-router-dom';
import { expect, it, describe } from 'vitest';
import { CivicProfile } from '@pages';
import { CIVIC_FORM_LIST } from '@components/CivicProfileForms';
import isAccessible from '../utils/axe';

describe('Civic Profile', () => {
const numLinks = CIVIC_FORM_LIST.length;

// TODO: Fix accessibility issues with this component
it.skip('should be accessible', () => {
isAccessible(
render(
<BrowserRouter>
<CivicProfile />
</BrowserRouter>
)
);
});

it('renders buttons for all forms in CIVIC_FORM_LIST', () => {
const { getByRole, getAllByRole } = render(
<BrowserRouter>
Expand Down
16 changes: 16 additions & 0 deletions test/pages/Signup.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { BrowserRouter } from 'react-router-dom';
import { Signup } from '@pages';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { SessionContext } from '@contexts';
import isAccessible from '../utils/axe';

vi.mock('@inrupt/solid-client');

Expand Down Expand Up @@ -37,6 +38,21 @@ const MockSignupContexts = ({ session }) => (
);

describe('Signup Page', () => {
it('should be accessible', () => {
const sessionObj = {
login: vi.fn(),
fetch: vi.fn(),
podUrl: 'https://example.com',
session: {
info: {
webId: 'https://example.com/profile/',
isLoggedIn: false
}
}
};
isAccessible(render(<MockSignupContexts session={sessionObj} />));
});

it('renders', () => {
const sessionObj = {
login: vi.fn(),
Expand Down

0 comments on commit 3d61040

Please sign in to comment.