-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andrew Lee
committed
Sep 27, 2018
1 parent
750c2e3
commit b6ccb80
Showing
12 changed files
with
222 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* global axe */ | ||
import Service from '@ember/service'; | ||
import { next } from '@ember/runloop'; | ||
|
||
export default Service.extend({ | ||
init() { | ||
this._super(...arguments); | ||
this._timer = null; | ||
this._queue = []; | ||
}, | ||
|
||
/** | ||
* Axe v3 contains a concurrency issue which breaks the component auditing feature. | ||
* This service defers axe.run calls on onto the next loop so that concurrent | ||
* axe executions do not occur. | ||
* | ||
* @see(https://github.com/dequelabs/axe-core/issues/1041) | ||
* @public | ||
* @param {HTMLElement} element axe context | ||
* @param {Object} options axe configuration options | ||
* @param {Function} callback axe audit callback | ||
* @return {Void} | ||
*/ | ||
run(element, options, callback) { | ||
if (this._timer) { | ||
this._queue.push(arguments); | ||
} else { | ||
this._timer = next(() => { | ||
if (element && element.parentNode) { | ||
axe.run(element, options, callback); | ||
} | ||
|
||
this._timer = null; | ||
|
||
if (this._queue.length) { | ||
this.run(...this._queue.shift()); | ||
} | ||
}); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from 'ember-a11y-testing/services/concurrent-axe'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<input | ||
class="c-text-input__input" | ||
id={{id}} | ||
id={{inputId}} | ||
type="text" | ||
placeholder={{placeholder}} | ||
value={{value}}> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.