-
Notifications
You must be signed in to change notification settings - Fork 794
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
21 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { isVisibleOnScreen } from '../commons/dom'; | ||
|
||
export default function isVisibleOnScreenMatches(node) { | ||
return isVisibleOnScreen(node); | ||
export default function isVisibleOnScreenMatches(node, virtualNode) { | ||
return isVisibleOnScreen(virtualNode); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,30 @@ | ||
describe('is-visible-on-screen-matches', function () { | ||
describe('is-visible-on-screen-matches', () => { | ||
'use strict'; | ||
|
||
var rule; | ||
var fixture = document.getElementById('fixture'); | ||
var fixtureSetup = axe.testUtils.fixtureSetup; | ||
const rule = axe.utils.getRule('avoid-inline-spacing'); | ||
const queryFixture = axe.testUtils.queryFixture; | ||
|
||
beforeEach(function () { | ||
fixture.innerHTML = ''; | ||
rule = axe.utils.getRule('avoid-inline-spacing'); | ||
it('returns true for visible elements', () => { | ||
const vNode = queryFixture('<p id="target">Hello world</p>'); | ||
assert.isTrue(rule.matches(null, vNode)); | ||
}); | ||
|
||
it('returns true for visible elements', function () { | ||
fixtureSetup('<p id="target">Hello world</p>'); | ||
assert.isTrue(rule.matches(fixture.firstChild)); | ||
it('returns false for elements with hidden', () => { | ||
const vNode = queryFixture('<p id="target" hidden>Hello world</p>'); | ||
assert.isFalse(rule.matches(null, vNode)); | ||
}); | ||
|
||
it('returns false for elements with hidden', function () { | ||
fixtureSetup('<p id="target" hidden>Hello world</p>'); | ||
assert.isFalse(rule.matches(fixture.firstChild)); | ||
it('returns true for visible elements with aria-hidden="true"', () => { | ||
const vNode = queryFixture( | ||
'<p id="target" aria-hidden="true">Hello world</p>' | ||
); | ||
assert.isTrue(rule.matches(null, vNode)); | ||
}); | ||
|
||
it('returns true for visible elements with aria-hidden="true"', function () { | ||
fixtureSetup('<p id="target" aria-hidden="true">Hello world</p>'); | ||
assert.isTrue(rule.matches(fixture.firstChild)); | ||
}); | ||
|
||
it('returns false for opacity:0 elements with accessible text', function () { | ||
fixtureSetup('<p id="target" style="opacity:0">Hello world</p>'); | ||
assert.isFalse(rule.matches(fixture.firstChild)); | ||
it('returns false for opacity:0 elements with accessible text', () => { | ||
const vNode = queryFixture( | ||
'<p id="target" style="opacity:0">Hello world</p>' | ||
); | ||
assert.isFalse(rule.matches(null, vNode)); | ||
}); | ||
}); |