Skip to content

Commit

Permalink
fix(respondable): Use the hard-coded axe.application name as default
Browse files Browse the repository at this point in the history
  • Loading branch information
isner committed Apr 4, 2018
1 parent affd75c commit ab4a49f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions lib/core/utils/respondable.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @private
*/
function _getSource() {
var application = 'axe', version = '', src;
var application = 'axeAPI', version = '', src;
if (typeof axe !== 'undefined' && axe._audit && axe._audit.application) {
application = axe._audit.application;
}
Expand All @@ -37,8 +37,8 @@
return ( // Check the version matches
postedMessage._source === messageSource ||
// Allow free communication with axe test
postedMessage._source === 'axe.x.y.z' ||
messageSource === 'axe.x.y.z'
postedMessage._source === 'axeAPI.x.y.z' ||
messageSource === 'axeAPI.x.y.z'
);
}
return false;
Expand Down
14 changes: 7 additions & 7 deletions test/core/utils/respondable.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe('axe.utils.respondable', function () {
event.initEvent('message', true, true);
event.data = JSON.stringify({
_respondable: true,
_source: 'axe.2.0.0',
_source: 'axeAPI.2.0.0',
topic: 'Death star',
message: 'Help us Obi-Wan',
uuid: mockUUID
Expand All @@ -133,14 +133,14 @@ describe('axe.utils.respondable', function () {
assert.isTrue(success);
});

it('should allow messages with _source axe.x.y.z', function () {
it('should allow messages with _source axeAPI.x.y.z', function () {
var success = false;
var event = document.createEvent('Event');
// Define that the event name is 'build'.
event.initEvent('message', true, true);
event.data = JSON.stringify({
_respondable: true,
_source: 'axe.x.y.z',
_source: 'axeAPI.x.y.z',
topic: 'Death star',
message: 'Help us Obi-Wan',
uuid: mockUUID
Expand All @@ -164,7 +164,7 @@ describe('axe.utils.respondable', function () {
event.initEvent('message', true, true);
event.data = JSON.stringify({
_respondable: true,
_source: 'axe.2.0.0',
_source: 'axeAPI.2.0.0',
topic: 'Death star',
message: 'Help us Obi-Wan',
uuid: mockUUID
Expand All @@ -189,7 +189,7 @@ describe('axe.utils.respondable', function () {
event.initEvent('message', true, true);
event.data = JSON.stringify({
_respondable: true,
_source: 'axe.2.0.0',
_source: 'axeAPI.2.0.0',
topic: 'Death star',
message: 'Help us Obi-Wan',
uuid: mockUUID
Expand Down Expand Up @@ -311,7 +311,7 @@ describe('axe.utils.respondable', function () {
event.initEvent('message', true, true);
event.data = JSON.stringify({
_respondable: true,
_source: 'axe.2.0.0',
_source: 'axeAPI.2.0.0',
topic: 'Death star',
error: {
name: 'ReferenceError',
Expand Down Expand Up @@ -340,7 +340,7 @@ describe('axe.utils.respondable', function () {
event.initEvent('message', true, true);
event.data = JSON.stringify({
_respondable: true,
_source: 'axe.2.0.0',
_source: 'axeAPI.2.0.0',
topic: 'Death star',
error: {
name: 'evil',
Expand Down

0 comments on commit ab4a49f

Please sign in to comment.