Skip to content

Commit

Permalink
fix(core): Define 'axe-core' as an AMD module (#859)
Browse files Browse the repository at this point in the history
* fix(core): Explicitly name the axe module 'axe-core'

Avoid the "Mismatched anonymous define() modules" error when the axe script is injected in a page that uses requireJS

Closes #849

* fix: Prevent color rules from crashing Chrome 66+ #856 (#861)

* chore: Release axe-core 3.0.2

* chore: Enable Greenkeeper for managing dependencies (#847)

* chore: add Greenkeeper config file

* chore(package): update dependencies

* chore(package): update dependencies

* chore(package): update dependencies

* chore(package): update dependencies

* chore(package): update dependencies

* chore(package): update dependencies

* docs(readme): add Greenkeeper badge

* chore: update to use babel-core

* chore: update to latest uglify config properties

`bracketize` became `braces` and `expect` became `reserved`

* chore: add sri-history lifecycle hook to release (#844)

* chore: disable growl to prevent errors in testing

* chore: Rename Jest example to help greenkeeper (#871)

* chore: rename jest example to help greenkeeper

plus signs are invalid in filenames/directories

Closes #869

* chore: add config to jest_react example

Closes #865

* fix(core): Explicitly name the axe module 'axe-core'

Avoid the "Mismatched anonymous define() modules" error when the axe script is injected in a page that uses requireJS

Closes #849

* test(core): Validate that the axe module is named 'axe-core'

Added integration test to check the value of the first argument to define()

Closes #849
  • Loading branch information
noead01 authored and WilcoFiers committed May 19, 2018
1 parent 9c4d84e commit 7b46f63
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ var axe = axe || {};
axe.version = '<%= pkg.version %>';

if (typeof define === 'function' && define.amd) {
define([], function () {
// Explicitly naming the module to avoid mismatched anonymous define() modules when injected in a page
define('axe-core', [], function () {
'use strict';
return axe;
});
Expand Down
11 changes: 9 additions & 2 deletions test/integration/full/umd/umd-define.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ describe('UMD define', function () {
assert.equal(defineCalls.length, 1);

var call = defineCalls[0];
assert.isFunction(call[1]);
assert.strictEqual(call[1](), axe);
assert.isFunction(call[2]);
assert.strictEqual(call[2](), axe);
});

it('defines module name as axe-core', function () {
assert.equal(defineCalls.length, 1);

var call = defineCalls[0];
assert.equal(call[0], 'axe-core');
});

});

0 comments on commit 7b46f63

Please sign in to comment.