From 1dc87727a5550aad297cc7cb51fdc2acbf139d3a Mon Sep 17 00:00:00 2001 From: Chris Hutchins Date: Wed, 1 Jul 2026 10:14:09 -0400 Subject: [PATCH 1/2] refactor(rules): use virtual node attr in *-matches functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Convert getAttribute/hasAttribute reads to the virtual node .attr()/.hasAttr() equivalents in the rules/*-matches cluster (xml-lang-mismatch, duplicate-id-active, duplicate-id-misc, frame-title-has-text, landmark-has-body-context). These are behavior-preserving drop-ins — .attr() returns the raw value or null with no trimming, matching getAttribute. Part of #5043 --- lib/rules/duplicate-id-active-matches.js | 4 ++-- lib/rules/duplicate-id-misc-matches.js | 4 ++-- lib/rules/frame-title-has-text-matches.js | 4 ++-- lib/rules/landmark-has-body-context-matches.js | 3 ++- lib/rules/xml-lang-mismatch-matches.js | 6 +++--- test/rule-matches/frame-title-has-text-matches.js | 6 +++--- test/rule-matches/html-xml-lang-mismatch.js | 8 ++++---- 7 files changed, 18 insertions(+), 17 deletions(-) diff --git a/lib/rules/duplicate-id-active-matches.js b/lib/rules/duplicate-id-active-matches.js index 819f21713a..487e3bdb77 100644 --- a/lib/rules/duplicate-id-active-matches.js +++ b/lib/rules/duplicate-id-active-matches.js @@ -2,8 +2,8 @@ import { getRootNode, isFocusable } from '../commons/dom'; import { isAccessibleRef } from '../commons/aria'; import { escapeSelector } from '../core/utils'; -function duplicateIdActiveMatches(node) { - const id = node.getAttribute('id').trim(); +function duplicateIdActiveMatches(node, virtualNode) { + const id = virtualNode.attr('id').trim(); const idSelector = `*[id="${escapeSelector(id)}"]`; const idMatchingElms = Array.from( getRootNode(node).querySelectorAll(idSelector) diff --git a/lib/rules/duplicate-id-misc-matches.js b/lib/rules/duplicate-id-misc-matches.js index 9a5d3c2eea..88ec053f3b 100644 --- a/lib/rules/duplicate-id-misc-matches.js +++ b/lib/rules/duplicate-id-misc-matches.js @@ -2,8 +2,8 @@ import { getRootNode, isFocusable } from '../commons/dom'; import { isAccessibleRef } from '../commons/aria'; import { escapeSelector } from '../core/utils'; -function duplicateIdMiscMatches(node) { - const id = node.getAttribute('id').trim(); +function duplicateIdMiscMatches(node, virtualNode) { + const id = virtualNode.attr('id').trim(); const idSelector = `*[id="${escapeSelector(id)}"]`; const idMatchingElms = Array.from( getRootNode(node).querySelectorAll(idSelector) diff --git a/lib/rules/frame-title-has-text-matches.js b/lib/rules/frame-title-has-text-matches.js index d821d84e09..a3674f06ac 100644 --- a/lib/rules/frame-title-has-text-matches.js +++ b/lib/rules/frame-title-has-text-matches.js @@ -1,7 +1,7 @@ import { sanitize } from '../commons/text'; -function frameTitleHasTextMatches(node) { - const title = node.getAttribute('title'); +function frameTitleHasTextMatches(node, virtualNode) { + const title = virtualNode.attr('title'); return !!sanitize(title); } diff --git a/lib/rules/landmark-has-body-context-matches.js b/lib/rules/landmark-has-body-context-matches.js index 8e5a3eee3c..48a707127e 100644 --- a/lib/rules/landmark-has-body-context-matches.js +++ b/lib/rules/landmark-has-body-context-matches.js @@ -6,7 +6,8 @@ function landmarkHasBodyContextMatches(node, virtualNode) { // Filter elements that, within certain contexts, don't map their role. // e.g. a
inside a
is not a banner, but in the context it is return ( - node.hasAttribute('role') || !findUpVirtual(virtualNode, nativeScopeFilter) + virtualNode.hasAttr('role') || + !findUpVirtual(virtualNode, nativeScopeFilter) ); } diff --git a/lib/rules/xml-lang-mismatch-matches.js b/lib/rules/xml-lang-mismatch-matches.js index 053da616d0..ea65781d48 100644 --- a/lib/rules/xml-lang-mismatch-matches.js +++ b/lib/rules/xml-lang-mismatch-matches.js @@ -1,11 +1,11 @@ import { getBaseLang, isValidLang } from '../core/utils'; -function xmlLangMismatchMatches(node) { +function xmlLangMismatchMatches(node, virtualNode) { // using -> "selector": "html[lang][xml\\:lang]" to narrow down html with lang and xml:lang attributes // get primary base language for each of the attributes - const primaryLangValue = getBaseLang(node.getAttribute('lang')); - const primaryXmlLangValue = getBaseLang(node.getAttribute('xml:lang')); + const primaryLangValue = getBaseLang(virtualNode.attr('lang')); + const primaryXmlLangValue = getBaseLang(virtualNode.attr('xml:lang')); // ensure that the value specified is valid lang for both `lang` and `xml:lang` return isValidLang(primaryLangValue) && isValidLang(primaryXmlLangValue); diff --git a/test/rule-matches/frame-title-has-text-matches.js b/test/rule-matches/frame-title-has-text-matches.js index 0d2e1fdf72..f42d7c745e 100644 --- a/test/rule-matches/frame-title-has-text-matches.js +++ b/test/rule-matches/frame-title-has-text-matches.js @@ -13,18 +13,18 @@ describe('layout-table-matches', () => { it('should return true if title attribute has text', () => { fixture.innerHTML = ''; const node = fixture.firstChild; - assert.isTrue(rule.matches(node)); + assert.isTrue(rule.matches(node, new axe.VirtualNode(node))); }); it('should return false if title attribute is empty', () => { fixture.innerHTML = ''; const node = fixture.firstChild; - assert.isFalse(rule.matches(node)); + assert.isFalse(rule.matches(node, new axe.VirtualNode(node))); }); it('should return false if title attribute contains only whitespace', () => { fixture.innerHTML = ''; const node = fixture.firstChild; - assert.isFalse(rule.matches(node)); + assert.isFalse(rule.matches(node, new axe.VirtualNode(node))); }); }); diff --git a/test/rule-matches/html-xml-lang-mismatch.js b/test/rule-matches/html-xml-lang-mismatch.js index 1f1f29a2ec..c6a79144dc 100644 --- a/test/rule-matches/html-xml-lang-mismatch.js +++ b/test/rule-matches/html-xml-lang-mismatch.js @@ -20,20 +20,20 @@ describe('xml-lang-mismatch-matches', () => { }); it('returns false if the element does not contain lang or xml:lang attribute', () => { - const actual = rule.matches(dom); + const actual = rule.matches(dom, new axe.VirtualNode(dom)); assert.isFalse(actual); }); it('returns false if the element contains either/ only one of the lang or xml:lang attribute', () => { dom.setAttribute('lang', 'nl'); - const actual = rule.matches(dom); + const actual = rule.matches(dom, new axe.VirtualNode(dom)); assert.isFalse(actual); }); it('returns true if the element contains both lang and xml:lang attribute', () => { dom.setAttribute('lang', 'en'); dom.setAttribute('xml:lang', 'nl'); - const actual = rule.matches(dom); + const actual = rule.matches(dom, new axe.VirtualNode(dom)); assert.isTrue(actual); }); @@ -41,7 +41,7 @@ describe('xml-lang-mismatch-matches', () => { const node = document.createElement('svg'); node.setAttribute('lang', ''); node.setAttribute('xml:lang', 'nl'); - const actual = rule.matches(node); + const actual = rule.matches(node, new axe.VirtualNode(node)); assert.isFalse(actual); }); }); From 57fe304eacf963dab8eb0ecc23ecc45efb2adaec Mon Sep 17 00:00:00 2001 From: Chris Hutchins Date: Wed, 1 Jul 2026 10:26:10 -0400 Subject: [PATCH 2/2] refactor(checks): use virtual node attr in label/parsing/tables/generic checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Convert getAttribute/hasAttribute reads to the virtual node .attr()/.hasAttr() equivalents in help-same-as-label, hidden-explicit-label, multiple-label, parsing/duplicate-id, tables/scope-value, and generic/page-no-duplicate. Behavior-preserving drop-ins — .attr() returns the raw value or null, matching getAttribute. Update the affected check tests to pass a virtual node argument. Part of #5043 --- .../generic/page-no-duplicate-evaluate.js | 3 +- .../label/help-same-as-label-evaluate.js | 4 +- .../label/hidden-explicit-label-evaluate.js | 2 +- lib/checks/label/multiple-label-evaluate.js | 4 +- lib/checks/parsing/duplicate-id-evaluate.js | 4 +- lib/checks/tables/scope-value-evaluate.js | 4 +- test/checks/label/multiple-label.js | 147 +++++++++++++++--- test/checks/parser/duplicate-id.js | 32 +++- test/checks/tables/scope-value.js | 34 +++- 9 files changed, 188 insertions(+), 46 deletions(-) diff --git a/lib/checks/generic/page-no-duplicate-evaluate.js b/lib/checks/generic/page-no-duplicate-evaluate.js index 1ce7130035..19dbbe697d 100644 --- a/lib/checks/generic/page-no-duplicate-evaluate.js +++ b/lib/checks/generic/page-no-duplicate-evaluate.js @@ -28,8 +28,7 @@ function pageNoDuplicateEvaluate(node, options, virtualNode) { if (typeof options.nativeScopeFilter === 'string') { elms = elms.filter(elm => { return ( - elm.actualNode.hasAttribute('role') || - !findUpVirtual(elm, options.nativeScopeFilter) + elm.hasAttr('role') || !findUpVirtual(elm, options.nativeScopeFilter) ); }); } diff --git a/lib/checks/label/help-same-as-label-evaluate.js b/lib/checks/label/help-same-as-label-evaluate.js index 47b15769f6..71c228cf5e 100644 --- a/lib/checks/label/help-same-as-label-evaluate.js +++ b/lib/checks/label/help-same-as-label-evaluate.js @@ -3,7 +3,7 @@ import { idrefs } from '../../commons/dom'; function helpSameAsLabelEvaluate(node, options, virtualNode) { const labelText = labelVirtual(virtualNode); - let check = node.getAttribute('title'); + let check = virtualNode.attr('title'); if (!labelText) { return false; @@ -12,7 +12,7 @@ function helpSameAsLabelEvaluate(node, options, virtualNode) { if (!check) { check = ''; - if (node.getAttribute('aria-describedby')) { + if (virtualNode.attr('aria-describedby')) { const ref = idrefs(node, 'aria-describedby'); check = ref .map(thing => { diff --git a/lib/checks/label/hidden-explicit-label-evaluate.js b/lib/checks/label/hidden-explicit-label-evaluate.js index f74f285f91..79bf3bc8fb 100644 --- a/lib/checks/label/hidden-explicit-label-evaluate.js +++ b/lib/checks/label/hidden-explicit-label-evaluate.js @@ -9,7 +9,7 @@ function hiddenExplicitLabelEvaluate(node, options, virtualNode) { } const root = getRootNode(node); - const id = escapeSelector(node.getAttribute('id')); + const id = escapeSelector(virtualNode.attr('id')); const label = root.querySelector(`label[for="${id}"]`); if (label && !isVisibleToScreenReaders(label)) { diff --git a/lib/checks/label/multiple-label-evaluate.js b/lib/checks/label/multiple-label-evaluate.js index 0a3de55dbd..383193e3c0 100644 --- a/lib/checks/label/multiple-label-evaluate.js +++ b/lib/checks/label/multiple-label-evaluate.js @@ -6,8 +6,8 @@ import { } from '../../commons/dom'; import { escapeSelector } from '../../core/utils'; -function multipleLabelEvaluate(node) { - const id = escapeSelector(node.getAttribute('id')); +function multipleLabelEvaluate(node, options, virtualNode) { + const id = escapeSelector(virtualNode.attr('id')); let parent = node.parentNode; let root = getRootNode(node); root = root.documentElement || root; diff --git a/lib/checks/parsing/duplicate-id-evaluate.js b/lib/checks/parsing/duplicate-id-evaluate.js index 55b520c09e..c9baea6efd 100644 --- a/lib/checks/parsing/duplicate-id-evaluate.js +++ b/lib/checks/parsing/duplicate-id-evaluate.js @@ -1,8 +1,8 @@ import { getRootNode } from '../../commons/dom'; import { escapeSelector } from '../../core/utils'; -function duplicateIdEvaluate(node) { - const id = node.getAttribute('id').trim(); +function duplicateIdEvaluate(node, options, virtualNode) { + const id = virtualNode.attr('id').trim(); // Since empty ID's are not meaningful and are ignored by Edge, we'll // let those pass. if (!id) { diff --git a/lib/checks/tables/scope-value-evaluate.js b/lib/checks/tables/scope-value-evaluate.js index 170e8d7fcc..878b47ac53 100644 --- a/lib/checks/tables/scope-value-evaluate.js +++ b/lib/checks/tables/scope-value-evaluate.js @@ -1,5 +1,5 @@ -function scopeValueEvaluate(node, options) { - const value = node.getAttribute('scope').toLowerCase(); +function scopeValueEvaluate(node, options, virtualNode) { + const value = virtualNode.attr('scope').toLowerCase(); return options.values.indexOf(value) !== -1; } diff --git a/test/checks/label/multiple-label.js b/test/checks/label/multiple-label.js index 8f7f6169d2..f8011222bd 100644 --- a/test/checks/label/multiple-label.js +++ b/test/checks/label/multiple-label.js @@ -19,7 +19,12 @@ describe('multiple-label', () => { assert.isUndefined( axe.testUtils .getCheckEvaluate('multiple-label') - .call(checkContext, target) + .call( + checkContext, + target, + undefined, + axe.utils.getNodeFromTree(target) + ) ); assert.deepEqual(checkContext._relatedNodes, [l1, l2]); }); @@ -31,7 +36,12 @@ describe('multiple-label', () => { assert.isFalse( axe.testUtils .getCheckEvaluate('multiple-label') - .call(checkContext, target) + .call( + checkContext, + target, + undefined, + axe.utils.getNodeFromTree(target) + ) ); assert.deepEqual(checkContext._relatedNodes, [l1]); }); @@ -50,7 +60,12 @@ describe('multiple-label', () => { assert.isUndefined( axe.testUtils .getCheckEvaluate('multiple-label') - .call(checkContext, target) + .call( + checkContext, + target, + undefined, + axe.utils.getNodeFromTree(target) + ) ); assert.deepEqual(checkContext._relatedNodes, [l1, l2, l3]); }); @@ -64,7 +79,12 @@ describe('multiple-label', () => { assert.isFalse( axe.testUtils .getCheckEvaluate('multiple-label') - .call(checkContext, target) + .call( + checkContext, + target, + undefined, + axe.utils.getNodeFromTree(target) + ) ); assert.deepEqual(checkContext._relatedNodes, [l1]); }); @@ -80,7 +100,12 @@ describe('multiple-label', () => { assert.isFalse( axe.testUtils .getCheckEvaluate('multiple-label') - .call(checkContext, target) + .call( + checkContext, + target, + undefined, + axe.utils.getNodeFromTree(target) + ) ); assert.deepEqual(checkContext._relatedNodes, [l1]); }); @@ -95,7 +120,12 @@ describe('multiple-label', () => { assert.isUndefined( axe.testUtils .getCheckEvaluate('multiple-label') - .call(checkContext, target) + .call( + checkContext, + target, + undefined, + axe.utils.getNodeFromTree(target) + ) ); assert.deepEqual(checkContext._relatedNodes, [l1, l2]); }); @@ -113,7 +143,12 @@ describe('multiple-label', () => { assert.isUndefined( axe.testUtils .getCheckEvaluate('multiple-label') - .call(checkContext, target) + .call( + checkContext, + target, + undefined, + axe.utils.getNodeFromTree(target) + ) ); assert.deepEqual(checkContext._relatedNodes, [l1, l3]); }); @@ -130,7 +165,12 @@ describe('multiple-label', () => { assert.isUndefined( axe.testUtils .getCheckEvaluate('multiple-label') - .call(checkContext, target) + .call( + checkContext, + target, + undefined, + axe.utils.getNodeFromTree(target) + ) ); assert.deepEqual(checkContext._relatedNodes, [l1, l2]); }); @@ -147,7 +187,12 @@ describe('multiple-label', () => { assert.isUndefined( axe.testUtils .getCheckEvaluate('multiple-label') - .call(checkContext, target) + .call( + checkContext, + target, + undefined, + axe.utils.getNodeFromTree(target) + ) ); assert.deepEqual(checkContext._relatedNodes, [l1, l2]); }); @@ -162,7 +207,12 @@ describe('multiple-label', () => { assert.isUndefined( axe.testUtils .getCheckEvaluate('multiple-label') - .call(checkContext, target) + .call( + checkContext, + target, + undefined, + axe.utils.getNodeFromTree(target) + ) ); assert.deepEqual(checkContext._relatedNodes, [l1, l2]); }); @@ -175,7 +225,12 @@ describe('multiple-label', () => { assert.isFalse( axe.testUtils .getCheckEvaluate('multiple-label') - .call(checkContext, target) + .call( + checkContext, + target, + undefined, + axe.utils.getNodeFromTree(target) + ) ); }); @@ -193,7 +248,12 @@ describe('multiple-label', () => { assert.isUndefined( axe.testUtils .getCheckEvaluate('multiple-label') - .call(checkContext, target) + .call( + checkContext, + target, + undefined, + axe.utils.getNodeFromTree(target) + ) ); }); @@ -211,7 +271,12 @@ describe('multiple-label', () => { assert.isUndefined( axe.testUtils .getCheckEvaluate('multiple-label') - .call(checkContext, target) + .call( + checkContext, + target, + undefined, + axe.utils.getNodeFromTree(target) + ) ); }); @@ -225,7 +290,12 @@ describe('multiple-label', () => { assert.isFalse( axe.testUtils .getCheckEvaluate('multiple-label') - .call(checkContext, target) + .call( + checkContext, + target, + undefined, + axe.utils.getNodeFromTree(target) + ) ); }); @@ -239,7 +309,12 @@ describe('multiple-label', () => { assert.isFalse( axe.testUtils .getCheckEvaluate('multiple-label') - .call(checkContext, target) + .call( + checkContext, + target, + undefined, + axe.utils.getNodeFromTree(target) + ) ); }); @@ -253,7 +328,12 @@ describe('multiple-label', () => { assert.isFalse( axe.testUtils .getCheckEvaluate('multiple-label') - .call(checkContext, target) + .call( + checkContext, + target, + undefined, + axe.utils.getNodeFromTree(target) + ) ); }); @@ -271,7 +351,12 @@ describe('multiple-label', () => { assert.isUndefined( axe.testUtils .getCheckEvaluate('multiple-label') - .call(checkContext, target) + .call( + checkContext, + target, + undefined, + axe.utils.getNodeFromTree(target) + ) ); }); @@ -285,7 +370,12 @@ describe('multiple-label', () => { assert.isUndefined( axe.testUtils .getCheckEvaluate('multiple-label') - .call(checkContext, target) + .call( + checkContext, + target, + undefined, + axe.utils.getNodeFromTree(target) + ) ); }); @@ -300,7 +390,12 @@ describe('multiple-label', () => { assert.isFalse( axe.testUtils .getCheckEvaluate('multiple-label') - .call(checkContext, shadowTarget.firstElementChild) + .call( + checkContext, + shadowTarget.firstElementChild, + undefined, + axe.utils.getNodeFromTree(shadowTarget.firstElementChild) + ) ); }); @@ -317,7 +412,12 @@ describe('multiple-label', () => { assert.isFalse( axe.testUtils .getCheckEvaluate('multiple-label') - .call(checkContext, shadowTarget.firstElementChild) + .call( + checkContext, + shadowTarget.firstElementChild, + undefined, + axe.utils.getNodeFromTree(shadowTarget.firstElementChild) + ) ); }); @@ -334,7 +434,12 @@ describe('multiple-label', () => { assert.isUndefined( axe.testUtils .getCheckEvaluate('multiple-label') - .call(checkContext, shadowTarget.firstElementChild) + .call( + checkContext, + shadowTarget.firstElementChild, + undefined, + axe.utils.getNodeFromTree(shadowTarget.firstElementChild) + ) ); }); }); diff --git a/test/checks/parser/duplicate-id.js b/test/checks/parser/duplicate-id.js index caf0fcf8bc..2df3be750c 100644 --- a/test/checks/parser/duplicate-id.js +++ b/test/checks/parser/duplicate-id.js @@ -14,7 +14,9 @@ describe('duplicate-id', () => { fixture.innerHTML = '
'; const node = fixture.querySelector('#target'); assert.isTrue( - axe.testUtils.getCheckEvaluate('duplicate-id').call(checkContext, node) + axe.testUtils + .getCheckEvaluate('duplicate-id') + .call(checkContext, node, undefined, new axe.VirtualNode(node)) ); assert.equal(checkContext._data, node.id); assert.deepEqual(checkContext._relatedNodes, []); @@ -24,7 +26,9 @@ describe('duplicate-id', () => { fixture.innerHTML = '
'; const node = fixture.querySelector('#target'); assert.isFalse( - axe.testUtils.getCheckEvaluate('duplicate-id').call(checkContext, node) + axe.testUtils + .getCheckEvaluate('duplicate-id') + .call(checkContext, node, undefined, new axe.VirtualNode(node)) ); assert.equal(checkContext._data, node.id); assert.deepEqual(checkContext._relatedNodes, [node.nextSibling]); @@ -47,7 +51,9 @@ describe('duplicate-id', () => { const node = fixture.querySelector('[data-testelm="1"]'); assert.isTrue( - axe.testUtils.getCheckEvaluate('duplicate-id').call(checkContext, node) + axe.testUtils + .getCheckEvaluate('duplicate-id') + .call(checkContext, node, undefined, new axe.VirtualNode(node)) ); }); @@ -63,7 +69,9 @@ describe('duplicate-id', () => { const node = fixture.querySelector('[data-testelm="1"]'); assert.isTrue( - axe.testUtils.getCheckEvaluate('duplicate-id').call(checkContext, node) + axe.testUtils + .getCheckEvaluate('duplicate-id') + .call(checkContext, node, undefined, new axe.VirtualNode(node)) ); }); @@ -76,7 +84,9 @@ describe('duplicate-id', () => { fixture.appendChild(div); assert.isFalse( - axe.testUtils.getCheckEvaluate('duplicate-id').call(checkContext, node) + axe.testUtils + .getCheckEvaluate('duplicate-id') + .call(checkContext, node, undefined, new axe.VirtualNode(node)) ); assert.lengthOf(checkContext._relatedNodes, 1); assert.deepEqual(checkContext._relatedNodes, [shadow.querySelector('p')]); @@ -90,7 +100,9 @@ describe('duplicate-id', () => { fixture.appendChild(node); assert.isTrue( - axe.testUtils.getCheckEvaluate('duplicate-id').call(checkContext, node) + axe.testUtils + .getCheckEvaluate('duplicate-id') + .call(checkContext, node, undefined, new axe.VirtualNode(node)) ); assert.lengthOf(checkContext._relatedNodes, 0); }); @@ -104,7 +116,9 @@ describe('duplicate-id', () => { fixture.appendChild(div); assert.isTrue( - axe.testUtils.getCheckEvaluate('duplicate-id').call(checkContext, node) + axe.testUtils + .getCheckEvaluate('duplicate-id') + .call(checkContext, node, undefined, new axe.VirtualNode(node)) ); assert.lengthOf(checkContext._relatedNodes, 0); }); @@ -118,7 +132,9 @@ describe('duplicate-id', () => { fixture.appendChild(node); assert.isFalse( - axe.testUtils.getCheckEvaluate('duplicate-id').call(checkContext, node) + axe.testUtils + .getCheckEvaluate('duplicate-id') + .call(checkContext, node, undefined, new axe.VirtualNode(node)) ); assert.lengthOf(checkContext._relatedNodes, 1); assert.deepEqual(checkContext._relatedNodes, [node.querySelector('p')]); diff --git a/test/checks/tables/scope-value.js b/test/checks/tables/scope-value.js index 04f5c3a3c8..481db1e5a4 100644 --- a/test/checks/tables/scope-value.js +++ b/test/checks/tables/scope-value.js @@ -9,14 +9,26 @@ describe('scope-value', () => { fixture.innerHTML = '
'; const node = fixture.querySelector('td'); - assert.isTrue(axe.testUtils.getCheckEvaluate('scope-value')(node)); + assert.isTrue( + axe.testUtils.getCheckEvaluate('scope-value')( + node, + undefined, + new axe.VirtualNode(node) + ) + ); }); it('should return true if scope is "row"', () => { fixture.innerHTML = '
'; const node = fixture.querySelector('td'); - assert.isTrue(axe.testUtils.getCheckEvaluate('scope-value')(node)); + assert.isTrue( + axe.testUtils.getCheckEvaluate('scope-value')( + node, + undefined, + new axe.VirtualNode(node) + ) + ); }); it('should return false otherwise', () => { @@ -24,7 +36,13 @@ describe('scope-value', () => { '
'; const node = fixture.querySelector('td'); - assert.isFalse(axe.testUtils.getCheckEvaluate('scope-value')(node)); + assert.isFalse( + axe.testUtils.getCheckEvaluate('scope-value')( + node, + undefined, + new axe.VirtualNode(node) + ) + ); }); it('should support options.values', () => { @@ -33,9 +51,13 @@ describe('scope-value', () => { const node = fixture.querySelector('td'); assert.isTrue( - axe.testUtils.getCheckEvaluate('scope-value')(node, { - values: ['hahahahanothx'] - }) + axe.testUtils.getCheckEvaluate('scope-value')( + node, + { + values: ['hahahahanothx'] + }, + new axe.VirtualNode(node) + ) ); }); });