Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/forms/the-select-element/customizable-select/select-option-hover-styles.tentative.html - WPT Dashboard Interop Dashboard
<!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-vendor.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<style>
select, select::picker(select) {
appearance: base-select;
}
</style>
<select>
<option class=one>one</option>
<option class=two>two</option>
<option class=three disabled>disabled</option>
</select>
<script>
const select = document.querySelector('select');
const optionOne = document.querySelector('.one');
const optionTwo = document.querySelector('.two');
const disabledOption = document.querySelector('.three');
promise_test(async () => {
await test_driver.bless();
select.showPicker();
assert_true(select.matches(':open'),
'dropdown should open after calling showPicker().');
await (new test_driver.Actions()
.pointerMove(1, 1, {origin: optionOne}))
.send();
await new Promise(requestAnimationFrame);
assert_equals(getComputedStyle(optionOne).color, 'rgb(0, 0, 0)',
'Option color while hovering.');
assert_equals(getComputedStyle(optionOne).backgroundColor, 'lab(0 0 0 / 0.1)',
'Option background-color while hovering.');
await (new test_driver.Actions()
.pointerMove(1, 1, {origin: disabledOption}))
.send();
await new Promise(requestAnimationFrame);
assert_equals(getComputedStyle(disabledOption).color, 'lab(0 0 0 / 0.5)',
'Disabled option color while hovering.');
assert_equals(getComputedStyle(disabledOption).backgroundColor, 'rgba(0, 0, 0, 0)',
'Disabled option background-color while hovering.');
}, 'Hover styles should be present for appearance:base-select options.');
</script>