Skip to content

Commit

Permalink
Add checks for the caching invariant of element reflection
Browse files Browse the repository at this point in the history
  • Loading branch information
mrego committed May 17, 2022
1 parent 78ebac4 commit a84ca4d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dom/nodes/aria-element-reflection.tentative.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
// Element reference should be set if the content attribute was included.
assert_equals(parentListbox.getAttribute("aria-activedescendant"), "i1", "check content attribute after parsing.");
assert_equals(parentListbox.ariaActiveDescendantElement, i1, "check idl attribute after parsing.");
assert_equals(parentListbox.ariaActiveDescendantElement, parentListbox.ariaActiveDescendantElement, "check idl attribute caching after parsing.");

// If we set the content attribute, the element reference should reflect this.
parentListbox.setAttribute("aria-activedescendant", "i2");
assert_equals(parentListbox.ariaActiveDescendantElement, i2, "setting the content attribute updates the element reference.");
assert_equals(parentListbox.ariaActiveDescendantElement, parentListbox.ariaActiveDescendantElement, "check idl attribute caching after update.");

// Setting the element reference should be reflected in the content attribute.
parentListbox.ariaActiveDescendantElement = i1;
Expand Down Expand Up @@ -342,10 +344,12 @@
test(function(t) {
const billingElement = document.getElementById("billingElement")
assert_array_equals(input1.ariaLabelledByElements, [billingElement, nameElement], "parsed content attribute sets element references.");
assert_equals(input1.ariaLabelledByElements, input1.ariaLabelledByElements, "check idl attribute caching after parsing");
assert_equals(input2.ariaLabelledByElements, null, "Testing missing content attribute after parsing.");

input2.ariaLabelledByElements = [billingElement, addressElement];
assert_array_equals(input2.ariaLabelledByElements, [billingElement, addressElement], "Testing IDL setter/getter.");
assert_equals(input1.ariaLabelledByElements, input1.ariaLabelledByElements, "check idl attribute caching after update");
assert_equals(input2.getAttribute("aria-labelledby"), "billingElement addressElement");

// Remove the billingElement from the DOM.
Expand Down

0 comments on commit a84ca4d

Please sign in to comment.