summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/forms/the-selectlist-element/selectlist-button-closes-listbox.tentative.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/semantics/forms/the-selectlist-element/selectlist-button-closes-listbox.tentative.html')
-rw-r--r--testing/web-platform/tests/html/semantics/forms/the-selectlist-element/selectlist-button-closes-listbox.tentative.html51
1 files changed, 51 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/forms/the-selectlist-element/selectlist-button-closes-listbox.tentative.html b/testing/web-platform/tests/html/semantics/forms/the-selectlist-element/selectlist-button-closes-listbox.tentative.html
new file mode 100644
index 0000000000..d3e6febd78
--- /dev/null
+++ b/testing/web-platform/tests/html/semantics/forms/the-selectlist-element/selectlist-button-closes-listbox.tentative.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<link rel=author href="mailto:jarhar@chromium.org">
+<link rel=help href="https://bugs.chromium.org/p/chromium/issues/detail?id=1408838">
+<link rel=help href="https://github.com/openui/open-ui/issues/639">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/testdriver.js"></script>
+<script src="/resources/testdriver-vendor.js"></script>
+
+<selectlist id=defaultbutton-defaultlistbox>
+ <option>one</option>
+ <option>two</option>
+</selectlist>
+
+<selectlist id=custombutton-defaultlistbox>
+ <button type=selectlist>custom button</button>
+ <option>one</option>
+ <option>two</option>
+</selectlist>
+
+<selectlist id=defaultbutton-customlistbox>
+ <listbox>
+ <option>one</option>
+ <option>two</option>
+ </listbox>
+</selectlist>
+
+<selectlist id=custombutton-customlistbox>
+ <button type=selectlist>custom button</button>
+ <listbox>
+ <option>one</option>
+ <option>two</option>
+ </listbox>
+</selectlist>
+
+<script>
+document.querySelectorAll('selectlist').forEach(selectlist => {
+ promise_test(async () => {
+ assert_false(selectlist.matches(':open'),
+ 'The listbox should not be showing at the start of the test.');
+
+ await test_driver.click(selectlist);
+ assert_true(selectlist.matches(':open'),
+ 'The listbox should be showing after clicking the button.');
+
+ await test_driver.click(selectlist);
+ assert_false(selectlist.matches(':open'),
+ 'The listbox should be closed after clicking the button.');
+ }, `${selectlist.id}: Clicking the selectlist's button should toggle the listbox.`);
+});
+</script>