Skip to content

Commit

Permalink
Bug 1913848 [wpt PR 47678] - Update dir=auto traversal tests to not a…
Browse files Browse the repository at this point in the history
…pply element-only rules to ancestors, a=testonly

Automatic update from web-platform-tests
Update dir=auto traversal tests to not apply element-only rules to ancestors

This fixes web platform tests to match half of the spec update in
whatwg/html#10488 and
whatwg/html#10561 .  Prior to this change (in
spec and Gecko, although not in the Chromium code) the special rules for
dir=auto traversals that were intended to apply only to dir=auto on an
element and not to dir=auto on its ancestors (relating to
auto-directionality form-associated elements and to slots) were being
applied in one ancestor case, where the special element was an assigned
node of a slot.  This makes the test changes corresponding to the fix to
the HTML spec.

Bug: 576815, 352191350
Change-Id: I6ffa8e22acc6f71777df1165655eaa1c8891867e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5798082
Commit-Queue: David Baron <[email protected]>
Reviewed-by: Di Zhang <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1343842}

--

wpt-commits: fddc4be423e3243af4b3b4fb410361579ea97193
wpt-pr: 47678
  • Loading branch information
dbaron authored and moz-wptsync-bot committed Aug 21, 2024
1 parent a1136ca commit e5f9c68
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -376,23 +376,17 @@ test(() => {
}, 'dir=auto slot is not affected by text in value of input element children');

test(() => {
let [tree, shadow] = setup_tree(`
let tree = setup_tree(`
<div>
<div id=root>
<input value="اختبر">
abc
</div>
<input dir="auto" value="اختبر">
</div>
`,`
<slot dir=auto></slot>
`);
let slot = shadow.querySelector("slot");
assert_equals(html_direction(slot), "rtl");
let inp = tree.querySelector("input");
assert_equals(html_direction(inp), "rtl");
inp.type = "month";
assert_equals(html_direction(slot), "ltr");
assert_equals(html_direction(inp), "ltr");
tree.remove();
}, 'dir=auto slot is updated if input stops being auto-directionality form-associated');
}, 'input direction changes if it stops being auto-directionality form-associated');

test(() => {
let [tree, shadow] = setup_tree(`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,51 @@
tree.remove();
}, 'dir=auto slot ignores text in value of input element children');

test(() => {
let [tree, shadow] = setup_tree(`
<div>
<div id=root>
<input value="اختبر">
<input type=text value="اختبر">
abc
</div>
</div>
`,`
<slot dir=auto></slot>
`);
let slot = shadow.querySelector("slot");
assert_equals(html_direction(slot), "ltr");
tree.remove();
}, 'dir=auto slot is not affected by value of auto-directionality form associated elements');

test(() => {
let [tree, shadow] = setup_tree(`
<div>
<div id=root><div slot="inner">اختبر</div></div>
</div>
`,`
<slot name="outer">
<slot name="inner" dir="auto"></slot>
</slot>
`);
let slot = shadow.querySelector("slot[name='inner']");
assert_equals(html_direction(slot), "rtl");
tree.remove();
}, 'inner slot is given directionality from slotted content');

test(() => {
let [tree, shadow] = setup_tree(`
<div>
<div id=root><div slot="inner">اختبر</div></div>
</div>
`,`
<slot name="outer" dir=auto>
</slot>
`);
let slot = shadow.querySelector("slot[name='outer']");
slot.innerHTML = "<slot name='inner'></slot>";
assert_equals(html_direction(slot), "ltr");
tree.remove();
}, 'dir=auto slot is not affected by content inside inner slot (version 1)');

</script>

0 comments on commit e5f9c68

Please sign in to comment.