1 | import RSVP from 'rsvp';
|
2 | import a11yAudit from './audit';
|
3 | import utils from './utils';
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | function getUrlParameter(name) {
|
12 | const location = utils.getLocation();
|
13 | const regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
|
14 | const results = regex.exec(location.search);
|
15 | return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
|
16 | }
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | export default function a11yAuditIf(...args) {
|
25 | if(getUrlParameter('enableA11yAudit') === 'true') {
|
26 | return a11yAudit(...args);
|
27 | }
|
28 |
|
29 | return RSVP.resolve(undefined, 'a11y audit not run');
|
30 | }
|