diff options
Diffstat (limited to 'testing/web-platform/tests/html/semantics/forms/the-selectlist-element/selectlist-button-type-behavior.tentative.html')
-rw-r--r-- | testing/web-platform/tests/html/semantics/forms/the-selectlist-element/selectlist-button-type-behavior.tentative.html | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/forms/the-selectlist-element/selectlist-button-type-behavior.tentative.html b/testing/web-platform/tests/html/semantics/forms/the-selectlist-element/selectlist-button-type-behavior.tentative.html new file mode 100644 index 0000000000..cc7eb62a63 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-selectlist-element/selectlist-button-type-behavior.tentative.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> +<link rel=author href="mailto:jarhar@chromium.org"> +<link rel=help href="https://github.com/openui/open-ui/issues/702"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-actions.js"></script> +<script src="/resources/testdriver-vendor.js"></script> + +<selectlist> + <button type=selectlist id=b1>first button</button> + <button type=selectlist id=b2>second button</button> + <button id=b3>third button</button> + <option>option</option> +</selectlist> + +<script> +const ESC = '\uE00C' + +promise_test(async () => { + const selectlist = document.querySelector('selectlist'); + const b1 = document.getElementById('b1'); + const b2 = document.getElementById('b2'); + const b3 = document.getElementById('b3'); + + assert_false(selectlist.open, 'The selectlist should start closed.'); + await test_driver.click(b1); + assert_true(selectlist.open, 'The selectlist should get opened when the button is clicked.'); + + await test_driver.send_keys(selectlist, ESC); + assert_false(selectlist.open, 'Pressing escape should close the selectlist.'); + + await test_driver.click(b2); + assert_true(selectlist.open, 'The selectlist should get opened when a second type=selectlist button is clicked.'); + await test_driver.send_keys(selectlist, ESC); + assert_false(selectlist.open, 'Pressing escape should close the selectlist.'); + + await test_driver.click(b3); + assert_false(selectlist.open, 'Clicking a button witout type=selectlist should not open the listbox.'); + + b1.removeAttribute('type'); + await test_driver.click(b1); + assert_false(selectlist.open, 'If the button is not type=selectlist, it should not open the selectlist.'); +}, '<button type=selectlist> should open the parent selectlist when clicked.'); +</script> |