* Some div soup to semantic markup. * Small refactor to inline mapping of available tags. * Renamed <ItemListTags /> component to <TagList />. * Now a select is used for picking a tag to filter on. * Added custom Cypress command to create an article. * Added documentation for the create article custom command. * Removed unnecesary properties from payload to create an article. * reading list mobile view wip. * Reworked styles in <TagList />. * Reworked reading list to use <MediaQuery /> component. * Removed bottom padding from reading list header. * styling tweaks if there are no available tags. * Added some E2E tests. * Removed reading list component test in favour of e2e test. * Made breakpoint values numbers. * Added some padding and more grid gap to filter on small screens. * Adjusted jest coverage thresholds as we're moving some tests to e2e tests. * Reverting a VS Code setting change caused by one of my extensions. * First pass for E2E tests for the reading list. * Added some more grid gap. * Fixed load next page to send tags properly. * Added some more tests. * Improved label and placeholder for text filter in reading list. * Added more tests * Fixed media queries so it works in Chrome as well. * Removed aside as tag filters are not complimentary information. * Update app/javascript/readingList/components/TagList.jsx Co-authored-by: Suzanne Aitchison <suzanne@forem.com> * Update docs/tests/e2e-tests.md Co-authored-by: Suzanne Aitchison <suzanne@forem.com> * Turned off deprecated rule in jsx-a11y eslint plugin. * Reverted to links instead of radio buttons. * Added an all tags link and select option. * Fixed relayout issue. * Fixed View Archive button size. * Fixed styling of the load more button. * Fixed empty list issue toggling between archive and reading list. * Fixed request changes from PR review. * Removed CSS change that is no longer required. * Trigger Build * Fixed centering of items in top fieldset. * Fixed issue with search text field resetting reading list. * Fixed component tests for the reading list. * Fixed empty state popping up between search queries. * Fixed casing of fixture filenames. * Update app/javascript/readingList/readingList.jsx Co-authored-by: Suzanne Aitchison <suzanne@forem.com> * Reverted change in reading list component test. * Added missing JSDoc comment. * Now links are in an unordered list. * Promoted some CSS classes from the <nav /> to the <ul /> for spacing. Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
76 lines
1.9 KiB
JavaScript
76 lines
1.9 KiB
JavaScript
import { h } from 'preact';
|
|
import { render } from '@testing-library/preact';
|
|
import { axe } from 'jest-axe';
|
|
import fetch from 'jest-fetch-mock';
|
|
import { ReadingList } from '../readingList';
|
|
|
|
describe('<ReadingList />', () => {
|
|
beforeAll(() => {
|
|
global.window.matchMedia = jest.fn((query) => {
|
|
return {
|
|
matches: false,
|
|
media: query,
|
|
addListener: jest.fn(),
|
|
removeListener: jest.fn(),
|
|
};
|
|
});
|
|
});
|
|
|
|
const getMockResponse = () =>
|
|
JSON.stringify({
|
|
result: [
|
|
{
|
|
id: 1234567,
|
|
category: 'readinglist',
|
|
status: 'valid',
|
|
user_id: 1234,
|
|
reactable: {
|
|
id: 123456,
|
|
body_text: 'Some body text',
|
|
class_name: 'Article',
|
|
path: '/bobbytables/what-s-in-your-database-2d3f',
|
|
readable_publish_date_string: 'Jun 22',
|
|
reading_time: 0,
|
|
tags: [
|
|
{
|
|
name: 'css',
|
|
keywords_for_search: null,
|
|
},
|
|
{
|
|
name: 'discuss',
|
|
keywords_for_search: '',
|
|
},
|
|
],
|
|
title: "What's in your database?",
|
|
user: {
|
|
id: 318840,
|
|
name: 'Bobby Tables',
|
|
profile_image_90: 'https://picsum.photos/90/90',
|
|
username: 'bobbytables',
|
|
},
|
|
},
|
|
last_indexed_at: '2019-06-22T22:03:21.556Z',
|
|
},
|
|
],
|
|
total: 1,
|
|
});
|
|
|
|
beforeEach(() => {
|
|
global.fetch = fetch;
|
|
global.getCsrfToken = jest.fn(() => 'this-is-a-csrf-token');
|
|
});
|
|
|
|
afterEach(() => {
|
|
delete global.fetch;
|
|
delete global.getCsrfToken;
|
|
});
|
|
|
|
it('should have no a11y violations', async () => {
|
|
fetch.mockResponse(getMockResponse());
|
|
|
|
const { container } = render(<ReadingList availableTags={['discuss']} />);
|
|
const results = await axe(container);
|
|
|
|
expect(results).toHaveNoViolations();
|
|
});
|
|
});
|