Skip to content

Commit f3901f3

Browse files
Work around testdriver issue in select-mousedown-slot-mutation
Using test_driver.click() isn't working in chromium for certain elements, in this case the option element inside the picker. Using test_driver.Actions() gets around this issue. Bug: 488072422 Change-Id: I13068c98877473f9e6ef9a5fa22c6cc9c76444a9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7617854 Reviewed-by: Joey Arhar <jarhar@chromium.org> Reviewed-by: David Grogan <dgrogan@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Commit-Queue: David Grogan <dgrogan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1592705}
1 parent 36bdbc7 commit f3901f3

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

html/semantics/forms/the-select-element/customizable-select/select-mousedown-slot-mutation.optional.html

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<script src="/resources/testharnessreport.js"></script>
44
<script src="/resources/testdriver.js"></script>
55
<script src="/resources/testdriver-vendor.js"></script>
6+
<script src="/resources/testdriver-actions.js"></script>
67

78
<!-- This test verifies that mutating a select's options during mousedown
89
does not prevent the picker from opening. This is a regression test for
@@ -22,6 +23,14 @@
2223
</style>
2324

2425
<script>
26+
function click(element) {
27+
return (new test_driver.Actions()
28+
.pointerMove(0, 0, {origin: element})
29+
.pointerDown()
30+
.pointerUp())
31+
.send();
32+
}
33+
2534
const select = document.getElementById('test-select');
2635

2736
// Mutate the select's options on mousedown, similar to what
@@ -58,7 +67,7 @@
5867
assert_false(select.matches(':open'), 'select should be closed initially');
5968

6069
// Click the select - it should open despite the mousedown mutation
61-
await test_driver.click(select);
70+
await click(select);
6271

6372
assert_true(select.matches(':open'), 'select should be open after click despite mousedown mutation');
6473

@@ -76,12 +85,12 @@
7685
assert_equals(select.options[2].value, 'c', 'third option should be "c"');
7786

7887
// Click to open
79-
await test_driver.click(select);
88+
await click(select);
8089
assert_true(select.matches(':open'), 'select should be open');
8190

8291
// Verify options still work after mutation - click second option
8392
const option2 = select.options[1];
84-
await test_driver.click(option2);
93+
await click(option2);
8594

8695
assert_false(select.matches(':open'), 'select should be closed after selection');
8796
assert_equals(select.value, 'b', 'selected value should be "b"');

0 commit comments

Comments
 (0)