Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix example tests #4564

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions doc/examples/jest_react/jest.setup.js

This file was deleted.

12 changes: 4 additions & 8 deletions doc/examples/jest_react/link.test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import React from 'react';
import { mount, render } from 'enzyme';
import { render } from '@testing-library/react';
import axe from 'axe-core';

import Link from './link';

test('Link has no axe violations', done => {
const fixture = document.createElement('div');
document.body.appendChild(fixture);

const linkComponent = mount(
<Link page="http://www.axe-core.org">axe website</Link>,
{ attachTo: fixture }
const { container } = render(
<Link page="http://www.axe-core.org">axe website</Link>
);

const config = {
Expand All @@ -19,7 +15,7 @@ test('Link has no axe violations', done => {
'link-in-text-block': { enabled: false }
}
};
axe.run(fixture, config, (err, { violations }) => {
axe.run(container, config, (err, { violations }) => {
expect(err).toBe(null);
expect(violations).toHaveLength(0);
done();
Expand Down
22 changes: 9 additions & 13 deletions doc/examples/jest_react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,16 @@
"test": "jest"
},
"devDependencies": {
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
"axe-core": "^4.6.2",
"enzyme": "^3.11.0",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"@babel/preset-env": "^7.25.3",
"@babel/preset-react": "^7.24.7",
"@testing-library/jest-dom": "^6.4.8",
"@testing-library/react": "^16.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"jest": {
"testEnvironment": "jsdom",
"setupFilesAfterEnv": [
"<rootDir>/jest.setup.js"
]
"testEnvironment": "jsdom"
}
}
7 changes: 1 addition & 6 deletions doc/examples/qunit/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ module.exports = function (grunt) {
all: ['test/**/*.html'],
options: {
puppeteer: {
ignoreDefaultArgs: true,
args: [
'--headless',
'--disable-web-security',
'--allow-file-access-from-files'
]
args: ['--disable-web-security', '--allow-file-access-from-files']
},
timeout: 10000
}
Expand Down
8 changes: 4 additions & 4 deletions doc/examples/qunit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
},
"devDependencies": {
"axe-core": "^4.6.2",
"grunt": "^1.5.3",
"grunt-contrib-qunit": "^5.1.1",
"puppeteer": "^19.5.0",
"qunitjs": "^2.0.1"
"grunt": "^1.6.1",
"grunt-contrib-qunit": "^10.1.1",
"puppeteer": "^23.1.0",
"qunit": "^2.22.0"
}
}
4 changes: 2 additions & 2 deletions doc/examples/qunit/test/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<!-- Load local QUnit. -->
<link
rel="stylesheet"
href="../node_modules/qunitjs/qunit/qunit.css"
href="../node_modules/qunit/qunit/qunit.css"
media="screen"
/>
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
<script src="../node_modules/qunit/qunit/qunit.js"></script>
<!-- Load local lib and tests. -->
<script src="../node_modules/axe-core/axe.min.js"></script>
<script src="a11y.js"></script>
Expand Down
Loading