Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<link rel=author href="mailto:jarhar@chromium.org">
<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>