Commit aa3b0d88 authored by Lan Wei's avatar Lan Wei Committed by Chromium LUCI CQ

Simulate user inputs in css/selectors/focus-visible-002.html

Use testdriver Action API to simulate mouse actions in
css/selectors/focus-visible-002.html.

Bug: 1145677
Change-Id: Iff8d1700db152b97ab3af61a8f3e75d4ca6053bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2548723Reviewed-by: default avatarMustaq Ahmed <mustaq@chromium.org>
Commit-Queue: Lan Wei <lanwei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834374}
parent e5a6781d
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
<link rel="help" href="https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo" /> <link rel="help" href="https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo" />
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.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>
<style> <style>
:focus-visible { :focus-visible {
outline: darkgreen dotted 1px; /* fallback for Edge */ outline: darkgreen dotted 1px; /* fallback for Edge */
...@@ -37,7 +40,7 @@ ...@@ -37,7 +40,7 @@
<div> <div>
<input data-tested="false" id="input3" type="email" value="Focus me."></input> <input data-tested="false" id="input3" type="email" value="Focus me."></input>
</div> </div>
<div> <div>
<input data-tested="false" id="input4" type="password" value="Focus me."></input> <input data-tested="false" id="input4" type="password" value="Focus me."></input>
</div> </div>
<div> <div>
...@@ -78,6 +81,11 @@ ...@@ -78,6 +81,11 @@
</div> </div>
<script> <script>
async_test(function(t) { async_test(function(t) {
function mouseClickInTarget(selector) {
let target = document.querySelector(selector);
return test_driver.click(target);
}
function testNextTarget(e) { function testNextTarget(e) {
let el = e.target; let el = e.target;
assert_equals(getComputedStyle(el).outlineColor, "rgb(0, 100, 0)"); assert_equals(getComputedStyle(el).outlineColor, "rgb(0, 100, 0)");
...@@ -91,6 +99,8 @@ ...@@ -91,6 +99,8 @@
} }
} }
input1.addEventListener("click", t.step_func(testNextTarget)); input1.addEventListener("click", t.step_func(testNextTarget));
mouseClickInTarget("[data-tested=false]");
}, "Mouse focus on elements which would show a virtual keyboard should match :focus-visible"); }, "Mouse focus on elements which would show a virtual keyboard should match :focus-visible");
</script> </script>
</body> </body>
......
importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() {
return mouseClickInTarget("[data-tested=false]");
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment