Skip to content

Commit

Permalink
Merge branch 'master' into issue-1663
Browse files Browse the repository at this point in the history
  • Loading branch information
ErickRenteria authored Sep 27, 2023
2 parents e24aae1 + 581881c commit 881b4b3
Show file tree
Hide file tree
Showing 13 changed files with 245 additions and 4,327 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ export let aria_activedescendant_tabindex_valid: Rule = {
return null;
}

//check if the attribute 'aria-activedescendant' is valid for the role of the element

//ignore if the attribute 'aria-activedescendant' is blank
if (ruleContext.getAttribute("aria-activedescendant").trim().length === 0)
return;

// If the tabindex attribute is provided then verify that it is 0 or -1
passed = RPTUtil.isTabbable(ruleContext);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
/******************************************************************************
Copyright:: 2020- IBM, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*****************************************************************************/
-->

<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Sandbox</title>
<meta charset="UTF-8" />
</head>

<body>
<main>
<h1>Test page</h1>
<input role="combobox" tabindex="-1" aria-activedescendant="" />
</main>
<script type="text/javascript">
UnitTest = {
ruleIds: ["aria_activedescendant_tabindex_valid"],
results: [

]
}
</script>
</body>
</html>
25 changes: 16 additions & 9 deletions cypress-accessibility-checker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The plugin works by injecting the automated accessibility-checker testing into [
## Requirements

* [Node Version 18](https://nodejs.org/en/download/)
* Cypress 12
* Cypress 13

## Installation

Expand All @@ -27,25 +27,32 @@ There are two setup steps you must complete in order for the Cypress tests to be

### 1. Add plugin

In the `cypress/plugins/index.js` file located in your project, require the plugin and then register it with Cypress.
In the Cypress config for your project, require the plugin and then register it with Cypress.

```js
const aCheckerTasks = require('cypress-accessibility-checker/plugin');
module.exports = (on, config) => {
on('task', {
accessibilityChecker: aCheckerTasks
});
};
const { defineConfig } = require('cypress')

module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
on('task', {
accessibilityChecker: require('cypress-accessibility-checker/plugin')
});
}
}
})
```

### 2. Import commands

In the `cypress/support/index.js` file located in your project, add the following import statement. This will import the accessibility checker commands and register them with Cypress.
In the `cypress/support/e2e.js` file located in your project, add the following import statement. This will import the accessibility checker commands and register them with Cypress.

```js
import 'cypress-accessibility-checker';
```

If you do not want to include `cypress-accessibility-checker` globally, you may instead add this import statement to every test file in which it is used.

## Usage

The commands maps directly to the description of the APIs located [in the accessibility-checker/src/README](https://github.com/IBMa/equal-access/blob/master/accessibility-checker/src/README.md). The names of the APIs within Cypress are just slightly different so they are globally unique in the Cypress namespace.
Expand Down
8 changes: 4 additions & 4 deletions cypress-accessibility-checker/boilerplates/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ const { defineConfig } = require('cypress')

module.exports = defineConfig({
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
on('task', {
accessibilityChecker: require('cypress-accessibility-checker/plugin')
});
},
baseUrl: 'http://localhost:8080/sample-html',
supportFile: false
},
}
})

This file was deleted.

Loading

0 comments on commit 881b4b3

Please sign in to comment.