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

test: disable es6 syntax usage within tests directory #1569

Merged
merged 5 commits into from
May 15, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 5 additions & 1 deletion test/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"extends": ["prettier"],
"parserOptions":{
"ecmaVersion": 5
},
"env": {
"browser": true
"browser": true,
"es6": false
},
"globals": {
"describe": true,
Expand Down
8 changes: 4 additions & 4 deletions test/checks/lists/dlitem.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('dlitem', function() {
});

it('returns true if the dd/dt is in a div with a dl as grandparent', function() {
const nodeNames = ['dd', 'dt'];
var nodeNames = ['dd', 'dt'];
nodeNames.forEach(function(nodeName) {
var checkArgs = checkSetup(
'<dl><div><' +
Expand All @@ -80,7 +80,7 @@ describe('dlitem', function() {
});

it('returns false if the dd/dt is in a div with a role with a dl as grandparent with a list role', function() {
const nodeNames = ['dd', 'dt'];
var nodeNames = ['dd', 'dt'];
nodeNames.forEach(function(nodeName) {
var checkArgs = checkSetup(
'<dl><div role="list"><' +
Expand All @@ -94,7 +94,7 @@ describe('dlitem', function() {
});

it('returns false if the dd/dt is in a div[role=presentation] with a dl as grandparent', function() {
const nodeNames = ['dd', 'dt'];
var nodeNames = ['dd', 'dt'];
nodeNames.forEach(function(nodeName) {
var checkArgs = checkSetup(
'<dl><div role="presentation"><' +
Expand All @@ -108,7 +108,7 @@ describe('dlitem', function() {
});

it('returns false if the dd/dt is in a div[role=none] with a dl as grandparent', function() {
const nodeNames = ['dd', 'dt'];
var nodeNames = ['dd', 'dt'];
nodeNames.forEach(function(nodeName) {
var checkArgs = checkSetup(
'<dl><div role="none"><' +
Expand Down
2 changes: 1 addition & 1 deletion test/checks/mobile/css-orientation-lock.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('css-orientation-lock tests', function() {
};

function getSheet(data) {
const style = dynamicDoc.createElement('style');
var style = dynamicDoc.createElement('style');
style.type = 'text/css';
style.appendChild(dynamicDoc.createTextNode(data));
dynamicDoc.head.appendChild(style);
Expand Down
2 changes: 1 addition & 1 deletion test/commons/aria/arialabel-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('aria.arialabelText', function() {
var node = document.createElement('div');
var label = ' my label ';
node.setAttribute('aria-label', label);
const vNode = { actualNode: node };
var vNode = { actualNode: node };
assert.equal(aria.arialabelText(vNode), label);
});

Expand Down
14 changes: 7 additions & 7 deletions test/commons/aria/is-aria-role-allowed-on-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,11 @@ describe('aria.isAriaRoleAllowedOnElement', function() {
it('returns false, ensure evaluateRoleForElement in lookupTable is invoked', function() {
var overrideInvoked = false;
axe.commons.aria.lookupTable.evaluateRoleForElement = {
IMG: ({ node, out }) => {
IMG: function(options) {
overrideInvoked = true;
assert.isDefined(node);
assert.equal(node.nodeName.toUpperCase(), 'IMG');
assert.isBoolean(out);
assert.isDefined(options.node);
assert.equal(options.node.nodeName.toUpperCase(), 'IMG');
assert.isBoolean(options.out);
return false;
}
};
Expand All @@ -261,10 +261,10 @@ describe('aria.isAriaRoleAllowedOnElement', function() {
it('returns false if element with role MENU type context', function() {
var overrideInvoked = false;
axe.commons.aria.lookupTable.evaluateRoleForElement = {
LI: ({ node }) => {
LI: function(options) {
overrideInvoked = true;
assert.isDefined(node);
assert.equal(node.nodeName.toUpperCase(), 'LI');
assert.isDefined(options.node);
assert.equal(options.node.nodeName.toUpperCase(), 'LI');
return false;
}
};
Expand Down
6 changes: 3 additions & 3 deletions test/commons/matches/from-definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('matches.fromDefinition', function() {

it('matches a definition with a `nodeName` property', function() {
fixture.innerHTML = '<div>foo</div>';
const matchers = [
var matchers = [
'div',
['div', 'span'],
/div/,
Expand All @@ -37,7 +37,7 @@ describe('matches.fromDefinition', function() {

it('matches a definition with an `attributes` property', function() {
fixture.innerHTML = '<div foo="bar">foo</div>';
const matchers = [
var matchers = [
'bar',
['bar', 'baz'],
/bar/,
Expand Down Expand Up @@ -65,7 +65,7 @@ describe('matches.fromDefinition', function() {

it('matches a definition with a `properties` property', function() {
fixture.innerHTML = '<input />';
const matchers = [
var matchers = [
'text',
['text', 'password'],
/text/,
Expand Down
2 changes: 1 addition & 1 deletion test/commons/matches/node-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('matches.nodeName', function() {

it('works with virtual nodes', function() {
fixture.innerHTML = '<h1>foo</h1>';
const virtualNode = { actualNode: fixture.firstChild };
var virtualNode = { actualNode: fixture.firstChild };
assert.isTrue(matchNodeName(virtualNode, 'h1'));
assert.isFalse(matchNodeName(virtualNode, 'div'));
});
Expand Down
2 changes: 1 addition & 1 deletion test/core/base/audit.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*global Audit, Rule */
/*global Audit, Rule, Promise */
describe('Audit', function() {
'use strict';

Expand Down
2 changes: 1 addition & 1 deletion test/core/reporters/raw-env.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('reporters - raw-env', function() {
var mockResults;
var orig;
var rawResults;
const env = helpers.getEnvironmentData();
var env = helpers.getEnvironmentData();

before(function() {
mockResults = [
Expand Down
8 changes: 4 additions & 4 deletions test/core/utils/get-stylesheet-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ describe('axe.utils.getStyleSheetFactory', function() {
});

it('returns a function when passed argument of dynamicDocument', function() {
const actual = axe.utils.getStyleSheetFactory(dynamicDoc);
var actual = axe.utils.getStyleSheetFactory(dynamicDoc);
assert.isFunction(actual);
});

it('returns a CSSOM stylesheet, when invoked with data (text)', function() {
const stylesheetFactory = axe.utils.getStyleSheetFactory(dynamicDoc);
const actual = stylesheetFactory({
data: `.someStyle{background-color:red;}`,
var stylesheetFactory = axe.utils.getStyleSheetFactory(dynamicDoc);
var actual = stylesheetFactory({
data: '.someStyle{background-color:red;}',
root: document,
priority: [1, 0]
});
Expand Down
6 changes: 3 additions & 3 deletions test/core/utils/parse-crossorigin-stylesheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('axe.utils.parseCrossOriginStylesheet', function() {
var options = {
rootNode: document,
shadowId: undefined,
convertDataToStylesheet,
convertDataToStylesheet: convertDataToStylesheet,
rootIndex: 1
};
var priority = [1, 0];
Expand Down Expand Up @@ -61,13 +61,13 @@ describe('axe.utils.parseCrossOriginStylesheet', function() {
});
});

it(`rejects when given url to fetch is not found`, function(done) {
it('rejects when given url to fetch is not found', function(done) {
var importUrl =
'https://make-up-a-website-that-does-not-exist.com/style.css';
var options = {
rootNode: document,
shadowId: undefined,
convertDataToStylesheet,
convertDataToStylesheet: convertDataToStylesheet,
rootIndex: 1
};
var priority = [1, 0];
Expand Down
6 changes: 3 additions & 3 deletions test/core/utils/parse-sameorigin-stylesheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('axe.utils.parseSameOriginStylesheet', function() {
var options = {
rootNode: document,
shadowId: undefined,
convertDataToStylesheet
convertDataToStylesheet: convertDataToStylesheet
};
var priority = [1, 0];
var importedUrls = [];
Expand Down Expand Up @@ -86,7 +86,7 @@ describe('axe.utils.parseSameOriginStylesheet', function() {
var options = {
rootNode: document,
shadowId: undefined,
convertDataToStylesheet
convertDataToStylesheet: convertDataToStylesheet
};
var priority = [1, 0];
var importedUrls = [];
Expand Down Expand Up @@ -132,7 +132,7 @@ describe('axe.utils.parseSameOriginStylesheet', function() {
var options = {
rootNode: document,
shadowId: undefined,
convertDataToStylesheet
convertDataToStylesheet: convertDataToStylesheet
};
var priority = [1, 0];
var importedUrls = [];
Expand Down
8 changes: 4 additions & 4 deletions test/core/utils/preload-cssom.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('axe.utils.preloadCssom', function() {
});

it('returns CSSOM object containing an array of sheets', function(done) {
var actual = axe.utils.preloadCssom({ treeRoot });
var actual = axe.utils.preloadCssom({ treeRoot: treeRoot });
actual
.then(function(cssom) {
assert.isAtLeast(cssom.length, 2);
Expand All @@ -48,7 +48,7 @@ describe('axe.utils.preloadCssom', function() {
});

it('returns CSSOM and ensure that each object have defined properties', function(done) {
var actual = axe.utils.preloadCssom({ treeRoot });
var actual = axe.utils.preloadCssom({ treeRoot: treeRoot });
actual
.then(function(cssom) {
assert.isAtLeast(cssom.length, 2);
Expand All @@ -69,7 +69,7 @@ describe('axe.utils.preloadCssom', function() {
});

it('returns false if number of sheets returned does not match stylesheets defined in document', function(done) {
var actual = axe.utils.preloadCssom({ treeRoot });
var actual = axe.utils.preloadCssom({ treeRoot: treeRoot });
actual
.then(function(cssom) {
assert.isFalse(cssom.length <= 1);
Expand All @@ -81,7 +81,7 @@ describe('axe.utils.preloadCssom', function() {
});

it('returns all stylesheets and ensure each sheet has property cssRules', function(done) {
var actual = axe.utils.preloadCssom({ treeRoot });
var actual = axe.utils.preloadCssom({ treeRoot: treeRoot });
actual
.then(function(cssom) {
cssom.forEach(function(s) {
Expand Down
10 changes: 5 additions & 5 deletions test/integration/full/preload-cssom/preload-cssom.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,16 @@ describe('preload cssom integration test', function() {
}

function getPreloadCssom(root) {
const treeRoot = axe.utils.getFlattenedTree(root ? root : document);
return axe.utils.preloadCssom({ treeRoot });
var treeRoot = axe.utils.getFlattenedTree(root ? root : document);
return axe.utils.preloadCssom({ treeRoot: treeRoot });
}

function commonTestsForRootNodeAndNestedFrame(root) {
it('returns cross-origin stylesheet', function(done) {
stylesForPage = [styleSheets.crossOriginLinkHref];
attachStylesheets(
{
root,
root: root,
styles: stylesForPage
},
function(err) {
Expand Down Expand Up @@ -120,7 +120,7 @@ describe('preload cssom integration test', function() {
stylesForPage = [styleSheets.crossOriginLinkHrefMediaPrint];
attachStylesheets(
{
root,
root: root,
styles: stylesForPage
},
function(err) {
Expand Down Expand Up @@ -149,7 +149,7 @@ describe('preload cssom integration test', function() {
];
attachStylesheets(
{
root,
root: root,
styles: stylesForPage
},
function(err) {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/full/preload/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('axe.utils.preload integration test', function() {
return axe.utils.preload({
preload: {
assets: ['cssom'],
timeout
timeout: timeout
}
});
}
Expand Down
1 change: 1 addition & 0 deletions test/integration/full/umd/umd-window.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*global Promise */
describe('UMD window', function() {
'use strict';

Expand Down