Skip to content

Commit

Permalink
test axe*.js, npm prepare
Browse files Browse the repository at this point in the history
  • Loading branch information
gaiety-deque committed May 28, 2024
1 parent 87c7845 commit 8b78165
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,10 @@
"sri-update": "grunt build && node build/sri-update && git add sri-history.json",
"sri-validate": "node build/sri-update --validate",
"fmt": "prettier --write .",
"prepare": "husky",
"prebuild": "node ./build/check-node-version.js && npm run unpatch",
"predevelop": "npm run unpatch",
"prepare": "husky && npm run unpatch && npm run patch",
"prebuild": "node ./build/check-node-version.js",
"pretest": "node ./build/check-node-version.js",
"postbuild": "prettier --write ./locales/_template.json ./doc/rule-descriptions.md && npm run patch",
"postdevelop": "npm run patch"
"postbuild": "prettier --write ./locales/_template.json ./doc/rule-descriptions.md"
},
"devDependencies": {
"@axe-core/webdriverjs": "^4.9.0",
Expand Down
20 changes: 19 additions & 1 deletion test/core/patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('patch test', function () {
}
});

it('patched: `CSS?.supports` optional chaining does not fail importing when `window.CSS === null`', async function () {
it('patched: `CSS?.supports` does not fail importing when `window.CSS === null` via color.js directly', async function () {
try {
const { default: Color } = await import('/color.js');
let color = new Color('slategray');
Expand All @@ -59,5 +59,23 @@ describe('patch test', function () {
assert.notOk(error);
}
});

it('patched: `CSS?.supports` does not fail importing when `window.CSS === null` via importing axe.js', async function () {
try {
await import('/axe.js');
} catch (error) {
// Should not hit this assertion
assert.notOk(error);
}
});

it('patched: `CSS?.supports` does not fail importing when `window.CSS === null` via importing axe.min.js', async function () {
try {
await import('/axe.min.js');
} catch (error) {
// Should not hit this assertion
assert.notOk(error);
}
});
});
});
4 changes: 3 additions & 1 deletion test/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ module.exports = function (config) {
served: true
},
'axe.js',
'axe.min.js',
'test/testutils.js'
].concat(testPaths),
proxies: {
Expand All @@ -114,7 +115,8 @@ module.exports = function (config) {
'/test': '/base/test',
'/mock': '/base/test/mock',
'/integration': '/base/test/integration',
'/axe.js': '/base/axe.js'
'/axe.js': '/base/axe.js',
'/axe.min.js': '/base/axe.min.js'
},
browsers: ['ChromeHeadless'],
reporters: ['spec'],
Expand Down

0 comments on commit 8b78165

Please sign in to comment.