Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/npm_and_yarn/jsdoc-4.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
straker committed Dec 18, 2023
2 parents 9cbc603 + 3ce3e3d commit c94f6e2
Show file tree
Hide file tree
Showing 258 changed files with 3,730 additions and 1,695 deletions.
18 changes: 8 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ unix_nightly_box: &unix_nightly_box

orbs:
puppeteer: threetreeslight/puppeteer@0.1.2
browser-tools: circleci/browser-tools@1.4.4
browser-tools: circleci/browser-tools@1.4.6

set_npm_auth: &set_npm_auth
run: npm config set "//registry.npmjs.org/:_authToken" $NPM_AUTH
Expand All @@ -33,9 +33,7 @@ restore_build: &restore_build
commands:
browser-tools-job:
steps:
- browser-tools/install-browser-tools:
# https://googlechromelabs.github.io/chrome-for-testing/ - 118.0.5993.70
chrome-version: 118.0.5993.70
- browser-tools/install-browser-tools

jobs:
# Fetch and cache dependencies.
Expand Down Expand Up @@ -243,15 +241,15 @@ jobs:
- <<: *restore_dependency_cache_unix
- run: npm run test:rule-help-version

# Test node API
test_node:
# Test jsdom API
test_jsdom:
<<: *defaults
<<: *unix_box
steps:
- checkout
- <<: *restore_dependency_cache_unix
- <<: *restore_build
- run: npm run test:node
- run: npm run test:jsdom

# Release a "next" version
next_release:
Expand Down Expand Up @@ -363,7 +361,7 @@ workflows:
- test_rule_help_version:
requires:
- build_unix
- test_node:
- test_jsdom:
requires:
- build_unix
# Verify the sri history is correct
Expand All @@ -388,7 +386,7 @@ workflows:
- test_virtual_rules
- build_api_docs
- test_rule_help_version
- test_node
- test_jsdom
- verify_sri
filters:
branches:
Expand All @@ -406,7 +404,7 @@ workflows:
- test_virtual_rules
- build_api_docs
- test_rule_help_version
- test_node
- test_jsdom
filters:
branches:
only: develop
Expand Down
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ module.exports = {
},
{
// polyfills are mostly copy-pasted from sources so we don't control their styling
files: ['lib/core/utils/pollyfills.js'],
files: [
'lib/core/imports/polyfills.js',
'lib/core/utils/pollyfill-elements-from-point.js'
],
env: {
browser: false
},
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
cache: 'npm'
# Workflows are not allowed to edit workflows. As result, we need to prevent Prettier from formatting them.
- name: Prevent workflows from being formatted
run: echo ".github" >> .prettierignore
run: echo ".github" >> .prettierignore && cat .prettierignore
- run: npm run fmt
# Prevent the prettierignore change from being committed.
- run: git checkout .prettierignore
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Tests

on:
pull_request:
push:
branches:
- master
- develop

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- run: npm ci
- run: npm run build
# v4 download seems to have some flakiness with the download of artifacts so pinning to v3 for now
# @see https://github.com/actions/download-artifact/issues/249
- uses: actions/upload-artifact@v3
with:
name: axe-core
path: axe.js
retention-days: 1

test_node:
strategy:
matrix:
node: [6, 18, 20]
runs-on: ubuntu-latest
timeout-minutes: 5
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node}}
- uses: actions/download-artifact@v3
with:
name: axe-core
- run: npm run test:node
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules/
doc/api
doc/api
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [4.8.3](https://github.com/dequelabs/axe-core/compare/v4.8.2...v4.8.3) (2023-12-18)

### Bug Fixes

- add Object.values polyfill for node <=6 ([#4274](https://github.com/dequelabs/axe-core/issues/4274)) ([b39b0e6](https://github.com/dequelabs/axe-core/commit/b39b0e60b68f8c1e34dc056809a04f8ccf8f24c7))

### [4.8.2](https://github.com/dequelabs/axe-core/compare/v4.8.1...v4.8.2) (2023-09-18)

### Bug Fixes
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ The [axe-core API](doc/API.md) package consists of:

## Localization

Axe can be built using your local language. To do so, a localization file must be added to the `./locales` directory. This file must have be named in the following manner: `<langcode>.json`. To build axe using this locale, instead of the default, run axe with the `--lang` flag, like so:
Axe can be built using your local language. To do so, a localization file must be added to the `./locales` directory. This file must be named in the following manner: `<langcode>.json`. To build axe using this locale, instead of the default, run axe with the `--lang` flag, like so:

`grunt build --lang=nl`

or equivalently:

`npm run build -- --lang=nl`

This will create a new build for axe, called `axe.<lang>.js` and `axe.<lang>.min.js`. If you want to build localized versions, simply pass in `--all-lang` instead. If you want to build multiple localized versions (but not all of them), you can pass in a comma-separated list of languages to the `--lang` flag, like `--lang=nl,ja`.
This will create a new build for axe, called `axe.<lang>.js` and `axe.<lang>.min.js`. If you want to build all localized versions, simply pass in `--all-lang` instead. If you want to build multiple localized versions (but not all of them), you can pass in a comma-separated list of languages to the `--lang` flag, like `--lang=nl,ja`.

To create a new translation for axe, start by running `grunt translate --lang=<langcode>`. This will create a json file fin the `./locales` directory, with the default English text in it for you to translate. Alternatively, you could copy `./locales/_template.json`. We welcome any localization for axe-core. For details on how to contribute, see the Contributing section below. For details on the message syntax, see [Check Message Template](/docs/check-message-template.md).

Expand Down
29 changes: 21 additions & 8 deletions axe.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// Type definitions for axe-core
// Project: https://github.com/dequelabs/axe-core
// Definitions by: Marcy Sutton <https://github.com/marcysutton>

declare namespace axe {
type ImpactValue = 'minor' | 'moderate' | 'serious' | 'critical' | null;

type TagValue = string;

type ReporterVersion = 'v1' | 'v2' | 'raw' | 'raw-env' | 'no-passes';
type ReporterVersion = 'v1' | 'v2' | 'raw' | 'rawEnv' | 'no-passes';

type RunOnlyType = 'rule' | 'rules' | 'tag' | 'tags';

Expand Down Expand Up @@ -132,7 +131,7 @@ declare namespace axe {
interface RunOptions {
runOnly?: RunOnly | TagValue[] | string[] | string;
rules?: RuleObject;
reporter?: ReporterVersion;
reporter?: ReporterVersion | string;
resultTypes?: resultGroups[];
selectors?: boolean;
ancestry?: boolean;
Expand Down Expand Up @@ -333,6 +332,14 @@ declare namespace axe {
xpath: string[];
ancestry: UnlabelledFrameSelector;
}
interface DqElement extends SerialDqElement {
element: Element;
toJSON(): SerialDqElement;
mergeSpecs(
childSpec: SerialDqElement,
parentSpec: SerialDqElement
): SerialDqElement;
}
interface PartialRuleResult {
id: string;
result: 'inapplicable';
Expand All @@ -351,16 +358,21 @@ declare namespace axe {
frameContext: FrameContextObject;
}

interface RawCheckResult extends Omit<CheckResult, 'relatedNodes'> {
relatedNodes?: Array<SerialDqElement | DqElement>;
}

interface RawNodeResult<T extends 'passed' | 'failed' | 'incomplete'> {
any: CheckResult[];
all: CheckResult[];
none: CheckResult[];
node: SerialDqElement | DqElement;
any: RawCheckResult[];
all: RawCheckResult[];
none: RawCheckResult[];
impact: ImpactValue | null;
result: T;
}

interface RawResult extends Omit<Result, 'nodes'> {
inapplicable: [];
inapplicable: Array<never>;
passes: RawNodeResult<'passed'>[];
incomplete: RawNodeResult<'incomplete'>[];
violations: RawNodeResult<'failed'>[];
Expand All @@ -383,6 +395,7 @@ declare namespace axe {
attr(attr: string): string | null;
hasAttr(attr: string): boolean;
props: { [key: string]: unknown };
boundingClientRect: DOMRect;
}

interface Utils {
Expand All @@ -396,7 +409,7 @@ declare namespace axe {
DqElement: new (
elm: Element,
options?: { absolutePaths?: boolean }
) => SerialDqElement;
) => DqElement;
uuid: (
options?: { random?: Uint8Array | Array<number> },
buf?: Uint8Array | Array<number>,
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "axe-core",
"version": "4.8.2",
"version": "4.8.3",
"deprecated": true,
"contributors": [
{
Expand Down
2 changes: 1 addition & 1 deletion build/check-node-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const currentVersion = process.version.replace('v', '');

const minimumVersionMajor = 12;
const minimumVersionMajor = 18;
const currentVersionMajor = parseInt(currentVersion.split('.')[0]);

const usesMinimumVersion = currentVersionMajor >= minimumVersionMajor;
Expand Down
15 changes: 11 additions & 4 deletions build/tasks/aria-supported.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = function (grunt) {
* as `axe` does not exist until grunt task `build:uglify` is complete,
* hence cannot be required at the top of the file.
*/
const done = this.async();
const { langs } = this.options();
const fileNameSuffix = langs && langs.length > 0 ? `${langs[0]}` : '';
const axe = require(`../../axe${fileNameSuffix}`);
Expand Down Expand Up @@ -69,10 +70,16 @@ module.exports = function (grunt) {
const destFile = this.data.destFile;
// Format the content so Prettier doesn't create a diff after running.
// See https://github.com/dequelabs/axe-core/issues/1310.
const formattedContent = format(content, destFile);

// write `aria supported` file contents
grunt.file.write(destFile, formattedContent);
format(content, destFile)
.then(formattedContent => {
// write `aria supported` file contents
grunt.file.write(destFile, formattedContent);
done();
})
.catch(err => {
console.error(err.message);
done(false);
});

/**
* Get list of aria attributes, from `aria-query`
Expand Down
25 changes: 14 additions & 11 deletions build/tasks/configure.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/*eslint-env node */
'use strict';
var buildRules = require('../configure');
var format = require('../shared/format');
const buildRules = require('../configure');
const format = require('../shared/format');

module.exports = function (grunt) {
grunt.registerMultiTask(
'configure',
'Task for configuring rules and checks',
function () {
var done = this.async();
var options = this.options({
const done = this.async();
const options = this.options({
rules: ['lib/rules/**/*.json'],
checks: ['lib/checks/**/*.json'],
misc: ['lib/misc/**/*.json'],
Expand All @@ -18,7 +18,7 @@ module.exports = function (grunt) {
});

this.files.forEach(function (file) {
var match = file.dest.auto.match(/\.([a-z]{2,3})\.js/);
const match = file.dest.auto.match(/\.([a-z]{2,3})\.js/);
if (match) {
options.locale = match[1];
}
Expand All @@ -28,12 +28,15 @@ module.exports = function (grunt) {

// Format the content so Prettier doesn't create a diff after running.
// See https://github.com/dequelabs/axe-core/issues/1310.
const descriptionsContent = format(
result.descriptions,
file.dest.descriptions
);
grunt.file.write(file.dest.descriptions, descriptionsContent);
done();
format(result.descriptions, file.dest.descriptions)
.then(descriptionsContent => {
grunt.file.write(file.dest.descriptions, descriptionsContent);
done();
})
.catch(err => {
console.error(err.message);
done(false);
});
});
});
}
Expand Down
2 changes: 1 addition & 1 deletion doc/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ The results of axe are grouped according to their outcome into the following arr
- `passes`: These results indicate what elements passed the rules
- `violations`: These results indicate what elements failed the rules
- `inapplicable`: These results indicate which rules did not run because no matching content was found on the page. For example, with no video, those rules won't run.
- `incomplete`: These results were aborted and require further testing. This can happen either because of technical restrictions to what the rule can test, or because a javascript error occurred.
- `incomplete`: Also known as "needs review," these results were aborted and require further testing. This can happen either because of technical restrictions to what the rule can test, or because a javascript error occurred.

Each object returned in these arrays have the following properties:

Expand Down
2 changes: 1 addition & 1 deletion doc/examples/qunit/test/test.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
Expand Down
Loading

0 comments on commit c94f6e2

Please sign in to comment.