Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoFiers committed Sep 8, 2016
1 parent 6216529 commit 02442fe
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 19 deletions.
6 changes: 3 additions & 3 deletions lib/checks/navigation/p-as-heading.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ options = options || {};
let margins = options.margins || [];

let nextSibling = siblings.slice(currentIndex+1)
.find(elm => elm.nodeName.toUpperCase() === 'P')
.find(elm => elm.nodeName.toUpperCase() === 'P');

let prevSibling = siblings.slice(0, currentIndex).reverse()
.find(elm => elm.nodeName.toUpperCase() === 'P')
.find(elm => elm.nodeName.toUpperCase() === 'P');

function getTextContainer(elm) {
let nextNode = elm;
Expand Down Expand Up @@ -52,7 +52,7 @@ function getStyleValues(node) {
};
}

function isHeaderStyle(styleA, styleB, margin) {
function isHeaderStyle(styleA, styleB, margins) {
return margins.reduce((out, margin) => {
return (out || (
(!margin.size || styleA.fontSize / margin.size > styleB.fontSize) &&
Expand Down
6 changes: 3 additions & 3 deletions lib/core/base/audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ Audit.prototype.setBranding = function (branding) {
let previous = {
brand: this.brand,
application: this.application
}
};
if (branding && branding.hasOwnProperty('brand') &&
branding.brand && typeof branding.brand === 'string') {
this.brand = branding.brand;
Expand All @@ -288,14 +288,14 @@ Audit.prototype._constructHelpUrls = function (previous = null) {
var version = axe.version.substring(0, axe.version.lastIndexOf('.'));
this.rules.forEach(rule => {
if (!this.data.rules[rule.id]) {
this.data.rules[rule.id] = {}
this.data.rules[rule.id] = {};
}
let metaData = this.data.rules[rule.id];
if (
typeof metaData.helpUrl !== 'string' ||
(previous && metaData.helpUrl === getHelpUrl(previous, rule.id, version))
) {
metaData.helpUrl = getHelpUrl(this, rule.id, version)
metaData.helpUrl = getHelpUrl(this, rule.id, version);
}
});
};
Expand Down
1 change: 0 additions & 1 deletion lib/rules/window-is-top.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/* global window */
return node.ownerDocument.defaultView.self === node.ownerDocument.defaultView.top;
18 changes: 11 additions & 7 deletions test/checks/navigation/p-as-heading.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,25 @@ describe('p-as-heading', function () {

it('returns false if any of the margins is passed', function () {
var options = {
margins: [{ size: 1.2, weight: 100 }],
margins: [{ size: 1.5 }],
margins: [{ italic: true }]
margins: [
{ size: 1.2, weight: 100 },
{ size: 1.5 },
{ italic: true }
],
};

fixture.innerHTML = '<p style="font-style:italic">elm 1</p> <p>elm 2</p>';
var node = fixture.querySelector('p');
assert.isFalse(checks['p-as-heading'].evaluate.call(checkContext, node, options));
})
});

it('returns true if none of the set margins is passed', function () {
var options = {
margins: [{ size: 1.2, weight: 100 }],
margins: [{ size: 1.5 }],
margins: [{ size: 1.2, italic: true }]
margins: [
{ size: 1.2, weight: 100 },
{ size: 1.5 },
{ size: 1.2, italic: true }
]
};

fixture.innerHTML = '<p style="font-size:1.5em">elm 1</p> <p>elm 2</p>';
Expand Down
6 changes: 3 additions & 3 deletions test/core/base/audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ describe('Audit', function () {
assert.equal(
audit.data.rules.target1.helpUrl,
'https://dequeuniversity.com/rules/myproject/x.y/target1?application=axeAPI'
)
assert.isUndefined(audit.data.rules.target2)
);
assert.isUndefined(audit.data.rules.target2);

assert.lengthOf(audit.rules, 2);
audit.brand = 'thing';
Expand Down Expand Up @@ -221,7 +221,7 @@ describe('Audit', function () {
'https://dequeuniversity.com/rules/customer-x/x.y/target?application=axeAPI'
);

})
});
});


Expand Down
4 changes: 2 additions & 2 deletions test/rule-matches/p-as-heading-matches.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ describe('p-as-heading-matches', function () {
'use strict';

var rule;
var fixture = document.getElementById('fixture')
var fixture = document.getElementById('fixture');

beforeEach(function () {
rule = axe._audit.rules.find(function (rule) {
Expand Down Expand Up @@ -60,7 +60,7 @@ describe('p-as-heading-matches', function () {
assert.isTrue(rule.matches(target));

fixture.innerHTML = '<p id="target">some text</p><div></div>';
var target = fixture.querySelector('#target');
target = fixture.querySelector('#target');

assert.isFalse(rule.matches(target));
});
Expand Down

0 comments on commit 02442fe

Please sign in to comment.