Skip to content

Commit

Permalink
fix(build): add lang query parameter to helpUrl when builing with a l…
Browse files Browse the repository at this point in the history
…ocale (#1909)

* fix(build); add lang query parameter to helpUrl when builing with a locale

* add test

* fix test
  • Loading branch information
straker committed Nov 21, 2019
1 parent 6b82a4c commit 8c5f9ef
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions build/configure.js
Expand Up @@ -276,6 +276,7 @@ function buildRules(grunt, options, commons, callback) {
auto: replaceFunctions(
JSON.stringify(
{
lang: options.locale || 'en',
data: metadata,
rules: rules,
checks: checks,
Expand Down
1 change: 1 addition & 0 deletions lib/core/base/audit.js
Expand Up @@ -308,6 +308,7 @@ Audit.prototype._init = function() {

axe.commons = commons = audit.commons;

this.lang = audit.lang || 'en';
this.reporter = audit.reporter;
this.commands = {};
this.rules = [];
Expand Down
7 changes: 7 additions & 0 deletions test/core/public/load.js
Expand Up @@ -49,6 +49,13 @@ describe('axe._load', function() {
assert.equal(axe.commons, 'foo');
});

it('should load with a lang', function() {
axe._load({
lang: 'ja'
});
assert.equal(axe._audit.lang, 'ja');
});

describe('respondable subscriber', function() {
it('should add a respondable subscriber', function() {
var mockAudit = {
Expand Down

0 comments on commit 8c5f9ef

Please sign in to comment.