1 |
efrain |
1 |
Description of axe import into Moodle
|
|
|
2 |
|
|
|
3 |
1/ Download the latest axe code somewhere (example /tmp/axe) using:
|
|
|
4 |
|
|
|
5 |
mkdir -p /tmp/axe
|
|
|
6 |
cd /tmp/axe
|
|
|
7 |
npm install axe-core --save-dev
|
|
|
8 |
|
|
|
9 |
Note down the version number displayed by the command, to update lib/thirdpartylibs.xml accordingly.
|
|
|
10 |
|
|
|
11 |
If the command does not output a version number, the version number can be found in package.json. You can simply open package.json
|
|
|
12 |
using your desired editor and look for the version number of axe-core. Alternatively, you may use the following commands:
|
|
|
13 |
- MacOS:
|
|
|
14 |
cat package.json | grep axe-core
|
|
|
15 |
- Linux:
|
|
|
16 |
cat package.json | grep '"version"' | awk -F '"' '{print $4}'
|
|
|
17 |
or
|
|
|
18 |
jq -r '.version' package.json
|
|
|
19 |
|
|
|
20 |
2/ Copy the following file to your local Moodle directory, to replace the old one:
|
|
|
21 |
|
|
|
22 |
cp /tmp/axe/node_modules/axe-core/axe.min.js [PATH TO YOUR MOODLE]/lib/behat/axe/
|
|
|
23 |
|
|
|
24 |
3/ Update lib/thirdpartylibs.xml with the new version number.
|
|
|
25 |
|
|
|
26 |
4/ Update the PHPDoc block of \behat_accessibility::run_axe_validation_for_tags() in
|
|
|
27 |
[PATH TO YOUR MOODLE]/lib/tests/behat/behat_accessibility.php to reflect the new version number.
|
|
|
28 |
|
|
|
29 |
5/ Run behat tests labelled with @accessibility and confirm they are passing with the new library version, or fix the failures
|
|
|
30 |
because the new version might raise issues that weren't detected previously:
|
|
|
31 |
|
|
|
32 |
php admin/tool/behat/cli/init.php --add-core-features-to-theme
|
|
|
33 |
php admin/tool/behat/cli/run.php --tags=@accessibility
|