Skip to content

Commit

Permalink
Infrastructure: Enable Greenkeeper dependency management (w3c#1103)
Browse files Browse the repository at this point in the history
For issue w3c#1101, enables Greenkeeper to update NPM packages and makes updates needed for latest versions of packages.

* chore(package): update dependencies
* docs(readme): add Greenkeeper badge
* chore(package): update lockfile package-lock.json
* chore: Run eslint fix for new version
* Fix minor whitespace changes being caught by new version
* Update CLI and require for new ava version
* Update ava cli
* Incorrect ava format
* Reupdate package-lock.json after merge conflicts
* new ava version requires string assertion messages
* Update regression report with new ava cli
  • Loading branch information
greenkeeper[bot] authored and mcking65 committed Oct 11, 2019
1 parent bc5b7ef commit 422ca61
Show file tree
Hide file tree
Showing 13 changed files with 2,961 additions and 4,622 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.com/w3c/aria-practices.svg?branch=master)](https://travis-ci.com/w3c/aria-practices)
[![Build Status](https://travis-ci.com/w3c/aria-practices.svg?branch=master)](https://travis-ci.com/w3c/aria-practices) [![Greenkeeper badge](https://badges.greenkeeper.io/w3c/aria-practices.svg)](https://greenkeeper.io/)

# WAI-ARIA: Authoring Practices Guide

Expand Down
2 changes: 1 addition & 1 deletion examples/slider/js/multithumb-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ Slider.prototype.handleMouseDown = function (event) {

};

// bind a mousemove event handler to move pointer
// bind a mousemove event handler to move pointer
document.addEventListener('mousemove', handleMouseMove);

// bind a mouseup event handler to stop tracking mouse movements
Expand Down
2 changes: 1 addition & 1 deletion examples/slider/js/slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ Slider.prototype.handleMouseDown = function (event) {

};

// bind a mousemove event handler to move pointer
// bind a mousemove event handler to move pointer
document.addEventListener('mousemove', handleMouseMove);

// bind a mouseup event handler to stop tracking mouse movements
Expand Down
2 changes: 1 addition & 1 deletion examples/slider/js/text-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ TSlider.prototype.handleMouseDown = function (event) {

};

// bind a mousemove event handler to move pointer
// bind a mousemove event handler to move pointer
document.addEventListener('mousemove', handleMouseMove);

// bind a mouseup event handler to stop tracking mouse movements
Expand Down
2 changes: 1 addition & 1 deletion examples/slider/js/vertical-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ VSlider.prototype.handleMouseDown = function (event) {

};

// bind a mousemove event handler to move pointer
// bind a mousemove event handler to move pointer
document.addEventListener('mousemove', handleMouseMove);

// bind a mouseup event handler to stop tracking mouse movements
Expand Down
7,454 changes: 2,889 additions & 4,565 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"lint:es": "eslint .",
"lint:js": "npm run lint:es",
"lint:html": "npm run vnu-jar",
"regression": "ava test/tests",
"regression": "ava test/tests/*.js",
"regression-report": "node test/util/report",
"test": "npm run lint && npm run regression",
"vnu-jar": "java -jar node_modules/vnu-jar/build/dist/vnu.jar --errors-only --filterfile .vnurc --no-langdetect --skip-non-html *.html examples/"
Expand All @@ -29,17 +29,17 @@
},
"homepage": "https://github.com/w3c/aria-practices#readme",
"devDependencies": {
"ava": "^0.25.0",
"ava": "^2.2.0",
"cheerio": "^1.0.0-rc.2",
"eslint": "^4.19.1",
"eslint": "^6.0.1",
"geckodriver": "^1.16.2",
"glob": "^7.1.4",
"husky": "^1.2.0",
"lint-staged": "^8.1.6",
"husky": "^3.0.1",
"lint-staged": "^9.2.0",
"selenium-webdriver": "^4.0.0-alpha.1",
"stylelint": "^9.8.0",
"stylelint": "^10.1.0",
"stylelint-config-standard": "^18.2.0",
"vnu-jar": "^18.7.23"
"vnu-jar": "^19.6.7"
},
"husky": {
"hooks": {
Expand Down
56 changes: 29 additions & 27 deletions scripts/reference-tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ let indexOfPropertiesAndStates = {};

console.log('Generating index...');

function getColumn(data, indexStart) {
function getColumn (data, indexStart) {
let count = 0;
let index = data.lastIndexOf('<tr', indexStart);

Expand All @@ -167,7 +167,7 @@ function getColumn(data, indexStart) {
return count;
}

function getRoles(data) {
function getRoles (data) {
let roles = [];

let indexStart = data.indexOf('<code>', 0);
Expand All @@ -194,7 +194,7 @@ function getRoles(data) {
return roles;
}

function getPropertiesAndStates(data) {
function getPropertiesAndStates (data) {
let propertiesAndStates = [];

let indexStart = data.indexOf('<code>', 0);
Expand All @@ -221,7 +221,7 @@ function getPropertiesAndStates(data) {
return propertiesAndStates;
}

function addExampleToRoles(roles, example) {
function addExampleToRoles (roles, example) {
for (let i = 0; i < roles.length; i++) {
let role = roles[i];

Expand All @@ -236,7 +236,7 @@ function addExampleToRoles(roles, example) {
}
}

function addExampleToPropertiesAndStates(props, example) {
function addExampleToPropertiesAndStates (props, example) {
for (let i = 0; i < props.length; i++) {
let prop = props[i];

Expand All @@ -251,27 +251,27 @@ function addExampleToPropertiesAndStates(props, example) {
}
}

function addLandmarkRole(landmark, hasLabel, title, ref) {
function addLandmarkRole (landmark, hasLabel, title, ref) {
let example = {
title: title,
ref: ref
};

addExampleToRoles(landmark, example);
if (hasLabel) {
addExampleToPropertiesAndStates(['aria-labelledby'], example);
addExampleToPropertiesAndStates([ 'aria-labelledby' ], example);
}
}

glob.sync('examples/!(landmarks)/**/!(index).html', {cwd: path.join(__dirname, '..'), nodir: true}).forEach(function (file) {
let data = fs.readFileSync(file, 'utf8');
let ref = file.replace('examples/', '');
let title = data.substring(data.indexOf('<title>') + 7, data.indexOf('</title>'))
.split('|')[0]
.replace('Examples', '')
.replace('Example of', '')
.replace('Example', '')
.trim();
.split('|')[0]
.replace('Examples', '')
.replace('Example of', '')
.replace('Example', '')
.trim();

let example = {
title: title,
Expand All @@ -283,16 +283,16 @@ glob.sync('examples/!(landmarks)/**/!(index).html', {cwd: path.join(__dirname, '
});

// Add landmark examples, since they are a different format
addLandmarkRole(['banner'], false, 'Banner Landmark', 'landmarks/banner.html');
addLandmarkRole(['complementary'], true, 'Complementary Landmark', 'landmarks/complementary.html');
addLandmarkRole(['contentinfo'], false, 'Contentinfo Landmark', 'landmarks/contentinfo.html');
addLandmarkRole(['form'], true, 'Form Landmark', 'landmarks/form.html');
addLandmarkRole(['main'], true, 'Main Landmark', 'landmarks/main.html');
addLandmarkRole(['navigation'], true, 'Navigation Landmark', 'landmarks/navigation.html');
addLandmarkRole(['region'], true, 'Region Landmark', 'landmarks/region.html');
addLandmarkRole(['search'], true, 'Search Landmark', 'landmarks/search.html');

function exampleListItem(item) {
addLandmarkRole([ 'banner' ], false, 'Banner Landmark', 'landmarks/banner.html');
addLandmarkRole([ 'complementary' ], true, 'Complementary Landmark', 'landmarks/complementary.html');
addLandmarkRole([ 'contentinfo' ], false, 'Contentinfo Landmark', 'landmarks/contentinfo.html');
addLandmarkRole([ 'form' ], true, 'Form Landmark', 'landmarks/form.html');
addLandmarkRole([ 'main' ], true, 'Main Landmark', 'landmarks/main.html');
addLandmarkRole([ 'navigation' ], true, 'Navigation Landmark', 'landmarks/navigation.html');
addLandmarkRole([ 'region' ], true, 'Region Landmark', 'landmarks/region.html');
addLandmarkRole([ 'search' ], true, 'Search Landmark', 'landmarks/search.html');

function exampleListItem (item) {
return `
<li><a href="${item.ref}">${item.title}</a></li>`;
}
Expand All @@ -305,7 +305,8 @@ let examplesByRole = sortedRoles.reduce(function (set, role) {
let examplesHTML = '';
if (examples.length === 1) {
examplesHTML = `<a href="${examples[0].ref}">${examples[0].title}</a>`;
} else {
}
else {
examplesHTML = `
<ul>${examples.map(exampleListItem).join('')}
</ul>\n `;
Expand All @@ -320,15 +321,16 @@ let examplesByRole = sortedRoles.reduce(function (set, role) {
$('#examples_by_role_tbody').html(examplesByRole);

let sortedPropertiesAndStates = Object.getOwnPropertyNames(indexOfPropertiesAndStates)
.sort();
.sort();

let examplesByProps = sortedPropertiesAndStates.reduce(function (set, prop) {
let examples = indexOfPropertiesAndStates[prop];

let examplesHTML = '';
if (examples.length === 1) {
examplesHTML = `<a href="${examples[0].ref}">${examples[0].title}</a>`;
} else {
}
else {
examplesHTML = `
<ul>${examples.map(exampleListItem).join('')}
</ul>\n `;
Expand All @@ -344,8 +346,8 @@ $('#examples_by_props_tbody').html(examplesByProps);

// cheeio seems to fold the doctype lines despite the template
const result = $.html()
.replace('<!DOCTYPE html>', '<!DOCTYPE html>\n')
.replace('<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">', '<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">\n')
.replace('<!DOCTYPE html>', '<!DOCTYPE html>\n')
.replace('<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">', '<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">\n');

fs.writeFile(exampleFilePath, result, function (err) {
if (err) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/regression-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ then
done
fi

AVACMD="npm run regression -- -t -c 1 test/tests ${ARGS}"
AVACMD="npm run regression -- -t -c 1 test/tests/*.js ${ARGS}"
echo "$ $AVACMD"

$AVACMD
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const path = require('path');
const { test } = require('ava');
const test = require('ava');
const webdriver = require('selenium-webdriver');
const { By } = require('selenium-webdriver');

Expand Down
8 changes: 4 additions & 4 deletions test/tests/menubar_menubar-1.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,13 +440,13 @@ ariaTest('Key ARROW_RIGHT moves focus to next menubar item',

for (let menuIndex = ex.numMenus - 1; menuIndex > 0; menuIndex--) {

// Send the ARROW_LEFT key
// Send the ARROW_LEFT key
await menubaritems[menuIndex].sendKeys(Key.ARROW_LEFT);

// Test the focus is on the previous menuitem
t.true(
await checkFocus(t, ex.menubarMenuitemSelector, menuIndex - 1),
'Sending key "ARROW_RIGHT" to menuitem ' + menuIndex + ' should move focus to menuitem ' + menuIndex - 1
'Sending key "ARROW_RIGHT" to menuitem ' + menuIndex + ' should move focus to menuitem ' + (menuIndex - 1)
);
}
});
Expand All @@ -460,7 +460,7 @@ ariaTest('Key ARROW_UP opens submenu, focus on last item',
const menus = await t.context.session.findElements(By.css(ex.menuSelector));
for (let menuIndex = 0; menuIndex < ex.numMenus; menuIndex++) {

// Send the ENTER key
// Send the ENTER key
await menubaritems[menuIndex].sendKeys(Key.UP);

// Test that the submenu is displayed
Expand Down Expand Up @@ -488,7 +488,7 @@ ariaTest('Key ARROW_DOWN opens submenu, focus on first item',
const menus = await t.context.session.findElements(By.css(ex.menuSelector));
for (let menuIndex = 0; menuIndex < ex.numMenus; menuIndex++) {

// Send the ENTER key
// Send the ENTER key
await menubaritems[menuIndex].sendKeys(Key.DOWN);

// Test that the submenu is displayed
Expand Down
18 changes: 9 additions & 9 deletions test/tests/menubar_menubar-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ ariaTest('Text "aria-checked" appropriately set on role="menitemradio"',

for (let grouping of ex.radioItemGroupings) {

// Reveal the elements in the dropdown
// Reveal the elements in the dropdown
await menus[grouping.menuIndex].sendKeys(Key.ARROW_DOWN);

const items = await t.context.session.findElements(By.css(grouping.itemsSelector));
Expand Down Expand Up @@ -587,13 +587,13 @@ ariaTest('Key ARROW_RIGHT moves focus to next menubar item',

for (let menuIndex = ex.numMenus - 1; menuIndex > 0; menuIndex--) {

// Send the ARROW_LEFT key
// Send the ARROW_LEFT key
await menuitems[menuIndex].sendKeys(Key.ARROW_LEFT);

// Test the focus is on the previous menuitem
t.true(
await checkFocus(t, ex.menubarMenuitemSelector, menuIndex - 1),
'Sending key "ARROW_RIGHT" to menuitem ' + menuIndex + ' should move focus to menuitem ' + menuIndex - 1
'Sending key "ARROW_RIGHT" to menuitem ' + menuIndex + ' should move focus to menuitem ' + (menuIndex - 1)
);
}
});
Expand All @@ -607,7 +607,7 @@ ariaTest('Key ARROW_UP opens submenu, focus on last item',
const submenus = await t.context.session.findElements(By.css(ex.submenuSelector));
for (let menuIndex = 0; menuIndex < ex.numMenus; menuIndex++) {

// Send the ENTER key
// Send the ENTER key
await menuitems[menuIndex].sendKeys(Key.UP);

// Test that the submenu is displayed
Expand Down Expand Up @@ -635,7 +635,7 @@ ariaTest('Key ARROW_DOWN opens submenu, focus on first item',
const submenus = await t.context.session.findElements(By.css(ex.submenuSelector));
for (let menuIndex = 0; menuIndex < ex.numMenus; menuIndex++) {

// Send the ENTER key
// Send the ENTER key
await menuitems[menuIndex].sendKeys(Key.DOWN);

// Test that the submenu is displayed
Expand Down Expand Up @@ -714,7 +714,7 @@ ariaTest('Character sends to menubar changes focus in menubar',
const menuitems = await t.context.session.findElements(By.css(ex.menubarMenuitemSelector));
for (let test of charIndexTest) {

// Send character to menuitem
// Send character to menuitem
await menuitems[test.sendIndex].sendKeys(test.sendChar);

// Test that the focus switches to the appropriate menuitem
Expand Down Expand Up @@ -873,7 +873,7 @@ ariaTest('ARROW_RIGHT to submenu closes submenu and opens next',
for (let menuIndex = 0; menuIndex < ex.numMenus; menuIndex++) {
for (let itemIndex = 0; itemIndex < ex.numSubmenuItems[menuIndex]; itemIndex++) {

// Open the submenu
// Open the submenu
await menuitems[menuIndex].sendKeys(Key.ENTER);

const items = await t.context.session.findElements(By.css(ex.allSubmenuItems[menuIndex]));
Expand Down Expand Up @@ -1048,13 +1048,13 @@ ariaTest('Character sends to menubar changes focus in menubar',
const menuitems = await t.context.session.findElements(By.css(ex.menubarMenuitemSelector));
for (let menuIndex = 0; menuIndex < ex.numMenus; menuIndex++) {

// Open the dropdown
// Open the dropdown
await menuitems[menuIndex].sendKeys(Key.ARROW_DOWN);
const items = await t.context.session.findElements(By.css(ex.allSubmenuItems[menuIndex]));

for (let test of charIndexTest[menuIndex]) {

// Send character to menuitem
// Send character to menuitem
const itemText = await items[test.sendIndex].getText();
await items[test.sendIndex].sendKeys(test.sendChar);

Expand Down
19 changes: 16 additions & 3 deletions test/util/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,24 @@ const processDocumentationInExampleFiles = function (exampleFiles, exampleCovera
const getRegressionTestCoverage = function (exampleCoverage) {
process.env.REGRESSION_COVERAGE_REPORT = 1;

const allTestFiles = [];
fs.readdirSync(testsPath).forEach(function (testfile) {
allTestFiles.push(path.join(testsPath, testfile));
});

const cmd = path.resolve(__dirname, '..', '..', 'node_modules', 'ava', 'cli.js');
const cmdargs = [testsPath, '--tap', '-c', '1'];
const cmdargs = [...allTestFiles, '--tap', '-c', '1'];

const output = spawnSync(cmd, cmdargs);
const avaResults = output.stdout.toString();
const avaError = output.stderr.toString();

if (avaError) {
console.log('AVA error with following message, exiting script.\n\n');
console.log(avaError);
process.exitCode = 1;
process.exit();
}

let testRegex = /^# (\S+) [>›] (\S+\.html) \[data-test-id="(\S+)"\]/gm;
let matchResults;
Expand Down Expand Up @@ -246,9 +259,9 @@ fs.readdirSync(testsPath).forEach(function (testFile) {
}
});

console.log('\nExamples without regression tests:\n');
console.log('\nExamples without any regression tests:\n');
console.log(examplesWithNoTestsReport || 'None found.\n');
console.log('\nExamples missing regression tests:\n');
console.log('\nExamples missing some regression tests:\n');
console.log(examplesMissingSomeTestsReport || 'None found.\n');
console.log('\nExamples documentation table rows without data-test-ids:\n');
console.log(missingTestIdsReport || 'None found.\n');
Expand Down

0 comments on commit 422ca61

Please sign in to comment.