0.2.0: axe.run doesn't polyfill Promise implementation
trentmwillis opened this issue · comments
Since axe.run doesn't polyfill a Promise implementation, if a browser doesn't support Promises natively and the consumer isn't providing a polyfill, things break. This wasn't caught in our test suite since we include the babel polyfill.
"polyfill" it 😝:
// vendor/ember-a11y-testing/promise-polyfill.js
(function() {
if (typeof self.Promise === 'undefined') {
self.Promise = Ember.RSVP.Promise;
}
})();
Then use app.import('vendor/ember-a11y-testing/promise-polyfill.js', { type: 'test' });
in index.js
.
The app.import
above needs to go above the app.import
for vendor/axe-core/axe.js
.
@rwjblue I have tried something similar to the above, but the issue is that Ember.RSVP.Promise ties into the run-loop. Thus, since we trigger the audit "after render" in the run-loop, we actually wind up with an infinite loop (from what I can tell).
So in trying to fix this, I keep running upon other issues. In particular, changing the implementation from using a Promise to a using callbacks uncovers the fact that we run additional audits during the run-loop when the application is getting destroyed. This is bad, but we have no way to prevent it.
Due to that, the above issue, and other factors, I've opened an issue to remove the auto-run feature, which makes the path forward substantially simpler.
With the removal of auto-run in #64 and the usage of RSVP.Promise
for the a11yAudit
helper, this should be resolved.