UNPKG

axe-core

Version:

Accessibility engine for automated Web UI testing

79 lines (76 loc) 1.97 kB
<!doctype html> <html> <head> <title>Message Iframe Fixture</title> <script src="../../../axe.js"></script> <script> axe._load({ rules: [{ id: 'html', selector: 'html', any: ['html'] }], checks: [{ id: 'html', evaluate: function () { return true; } }], messages: {}}); </script> <script> axe.registerPlugin({ id: 'multi', run: function (id, action, options, callback) { this._registry[id][action].call(this._registry[id], options, callback); }, add: function (impl) { this._registry[impl.id] = impl; }, commands: [{ id: 'run-multi', callback: function (data, callback) { return axe.plugins.multi.run(data.parameter, data.action, data.options, callback); } }] }); axe.plugins.multi.add({ id: 'hideall', run: function (options, callback) { var frames; var q = axe.utils.queue(); frames = axe.utils.toArray(document.querySelectorAll('iframe, frame')); if (frames.length) { frames.forEach(function (frame) { q.defer(function (done) { axe.utils.sendCommandToFrame(frame, { options: options, command: 'run-multi', parameter: 'hideall', action: 'run' }, done); }); }); } q.defer(function (done) { // implementation done('ola!'); }); q.then(function (data) { // done with all the frames var results = []; data.forEach(function (datum) { if (datum) { results = results.concat(datum); } }); callback(results); }); } }); </script> </head> <body> <input type="text"> <a href="#">link</a> </body> </html>