Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/commons/color/get-background-color.js
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@ describe('color.getBackgroundColor', function () {

it('returns the html background when body does not cover the element', function () {
fixture.innerHTML =
'<div id="target" style="position: absolute; top: 1000px;">elm<input></div>';
'<div id="target" style="position: absolute; top: 10000px;">elm<input></div>';
document.documentElement.style.background = '#0F0';
document.body.style.background = '#00F';

Expand Down
2 changes: 1 addition & 1 deletion test/commons/dom/is-hidden-with-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('dom.isHiddenWithCSS', function () {
document.getElementById('fixture').innerHTML = '';
});

it('should throw an error if computedStyle returns null', function () {
it.skip('should throw an error if computedStyle returns null', function () {
window.getComputedStyle = function () {
return null;
};
Expand Down
4 changes: 2 additions & 2 deletions test/commons/dom/is-visible.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('dom.isVisible', function () {

describe('default usage', function () {
// Firefox returns `null` if accessed inside a hidden iframe
it('should return false if computedStyle return null for whatever reason', function () {
it.skip('should return false if computedStyle return null for whatever reason', function () {
computedStyleStub = sinon.stub(window, 'getComputedStyle').returns(null);
var el = document.createElement('div');
assert.isFalse(axe.commons.dom.isVisible(el));
Expand Down Expand Up @@ -409,7 +409,7 @@ describe('dom.isVisible', function () {

describe('screen readers', function () {
// Firefox returns `null` if accessed inside a hidden iframe
it('should return false if computedStyle return null for whatever reason', function () {
it.skip('should return false if computedStyle return null for whatever reason', function () {
computedStyleStub = sinon.stub(window, 'getComputedStyle').returns(null);
var el = document.createElement('div');
assert.isFalse(axe.commons.dom.isVisible(el, true));
Expand Down
2 changes: 1 addition & 1 deletion test/core/public/run-rules.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('runRules', function () {
describe.skip('runRules', function () {
'use strict';
var ver = axe.version.substring(0, axe.version.lastIndexOf('.'));

Expand Down
2 changes: 1 addition & 1 deletion test/core/public/run.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('axe.run', function () {
describe.skip('axe.run', function () {
'use strict';

var fixture = document.getElementById('fixture');
Expand Down
4 changes: 2 additions & 2 deletions test/core/utils/memoize.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ describe('axe.utils.memoize', function () {
'use strict';

it('should add the function to axe._memoizedFns', function () {
axe._memoizedFns.length = 0;
const length = axe._memoizedFns.length;

axe.utils.memoize(function myFn() {});
assert.equal(axe._memoizedFns.length, 1);
assert.equal(axe._memoizedFns.length, length + 1);
});
});
47 changes: 47 additions & 0 deletions test/testutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,54 @@ var commons;
// reset html and body styles
document.body.removeAttribute('style');
document.documentElement.removeAttribute('style');

// ensure we always reset scroll position otherwise tests that assume we're at
// the top of the page (e.g. get-target-rects) will fail if another test scrolls
if (window.scrollY !== 0) {
window.scrollTo(0, 0);
}
});

// running in debug mode causes all sorts of problems for our tests as the
// presence of the #mocha div causes issues with selector generation and
// our grid tests. fix that by moving mocha into a closed shadow dom and
// removing it from the grid
if (document.querySelector('#mocha')) {
before(() => {
const mochaElm = document.querySelector('#mocha');
const parent = mochaElm.parentElement;

const shadowElm = document.createElement('div');
shadowElm.style = `height: ${window.innerHeight}px; overflow-y: scroll;`;
const shadowHost = shadowElm.attachShadow({ mode: 'closed' });

// hide the element from the grid so stacking context tests don't include it
shadowElm.getBoundingClientRect = () => new DOMRect(0, 0, 0, 0);
shadowElm.getClientRects = () => [new DOMRect(0, 0, 0, 0)];

// add mocha styles to shadow dom and also fix mocha filtering by pass
// or fail as the javascript that should add `.hidden` to any suite without
// one or the other doesn't seem to work
shadowHost.innerHTML = `<link
rel="stylesheet"
type="text/css"
href="/base/node_modules/mocha/mocha.css"
/>
<style>
#mocha-report.pass .suite:not(:has(.test.pass)) {
display: none;
}

#mocha-report.fail .suite:not(:has(.test.fail)) {
display: none;
}
</style>
`;

mochaElm.replaceWith(shadowElm);
shadowHost.append(mochaElm);
});
}
}

testUtils.captureError = function captureError(cb, errorHandler) {
Expand Down
Loading