|
8 | 8 | <script src="/resources/testdriver-actions.js"></script>
|
9 | 9 |
|
10 | 10 | <style>
|
11 |
| -#selecteditem { |
12 |
| - color: SelectedItemText; |
13 |
| - background-color: SelectedItem; |
14 |
| -} |
15 | 11 | select, select::picker(select) {
|
16 | 12 | appearance: base-select;
|
17 | 13 | }
|
18 | 14 | </style>
|
19 |
| -<div id=selecteditem>SelectedItem test colors</div> |
20 | 15 |
|
21 | 16 | <select>
|
22 | 17 | <option class=one>one</option>
|
|
31 | 26 | const disabledOption = document.querySelector('.three');
|
32 | 27 |
|
33 | 28 | promise_test(async () => {
|
34 |
| - await new Promise(requestAnimationFrame); |
35 |
| - const selectedItemTestElement = document.getElementById('selecteditem'); |
36 |
| - const selectedItemTextColor = getComputedStyle(selectedItemTestElement).color; |
37 |
| - const selectedItemColor = getComputedStyle(selectedItemTestElement).backgroundColor; |
38 |
| - |
39 | 29 | await test_driver.bless();
|
40 | 30 | select.showPicker();
|
41 | 31 | assert_true(select.matches(':open'),
|
|
45 | 35 | .pointerMove(1, 1, {origin: optionOne}))
|
46 | 36 | .send();
|
47 | 37 | await new Promise(requestAnimationFrame);
|
48 |
| - |
49 |
| - assert_equals(getComputedStyle(optionOne).color, selectedItemTextColor, |
50 |
| - 'The hovered option should have color:SelectedItemText.'); |
51 |
| - assert_equals(getComputedStyle(optionOne).backgroundColor, selectedItemColor, |
52 |
| - 'The hovered option should have background-color:SelectedItem.'); |
53 |
| - // SelectedItemTextColor might be the same as the default text color, so |
54 |
| - // don't test that optionTwo's color isn't selectedItemTextColor. |
55 |
| - assert_not_equals(getComputedStyle(optionTwo).backgroundColor, selectedItemColor, |
56 |
| - 'The not hovered option should not have background-color:SelectedItem.'); |
57 |
| - |
58 |
| - const disabledColor = getComputedStyle(disabledOption).color; |
59 |
| - const disabledBackgroundColor = getComputedStyle(disabledOption).backgroundColor; |
| 38 | + assert_equals(getComputedStyle(optionOne).color, 'rgb(0, 0, 0)', |
| 39 | + 'Option color while hovering.'); |
| 40 | + assert_equals(getComputedStyle(optionOne).backgroundColor, 'lab(0 0 0 / 0.2)', |
| 41 | + 'Option background-color while hovering.'); |
60 | 42 |
|
61 | 43 | await (new test_driver.Actions()
|
62 |
| - .pointerMove(1, 1, disabledOption)) |
| 44 | + .pointerMove(1, 1, {origin: disabledOption})) |
63 | 45 | .send();
|
64 | 46 | await new Promise(requestAnimationFrame);
|
65 |
| - |
66 |
| - assert_equals(getComputedStyle(disabledOption).color, disabledColor, |
67 |
| - 'Disabled options should not change color when hovered.'); |
68 |
| - assert_equals(getComputedStyle(disabledOption).backgroundColor, disabledBackgroundColor, |
69 |
| - 'Disabled options should not change background-color when hovered.'); |
| 47 | + assert_equals(getComputedStyle(disabledOption).color, 'lab(0 0 0 / 0.5)', |
| 48 | + 'Disabled option color while hovering.'); |
| 49 | + assert_equals(getComputedStyle(disabledOption).backgroundColor, 'rgba(0, 0, 0, 0)', |
| 50 | + 'Disabled option background-color while hovering.'); |
70 | 51 | }, 'Hover styles should be present for appearance:base-select options.');
|
71 | 52 | </script>
|
0 commit comments