summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/infrastructure/testdriver/actions/textEditCommands.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/infrastructure/testdriver/actions/textEditCommands.html')
-rw-r--r--testing/web-platform/tests/infrastructure/testdriver/actions/textEditCommands.html61
1 files changed, 61 insertions, 0 deletions
diff --git a/testing/web-platform/tests/infrastructure/testdriver/actions/textEditCommands.html b/testing/web-platform/tests/infrastructure/testdriver/actions/textEditCommands.html
new file mode 100644
index 0000000000..0bc533ecb0
--- /dev/null
+++ b/testing/web-platform/tests/infrastructure/testdriver/actions/textEditCommands.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>TestDriver actions: text edit commands</title>
+<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>
+
+<style>
+div { padding:0px; margin: 0px; }
+</style>
+<body>
+ <div>
+ <input type="text" id="text1" value="Hello World" />
+ <input type="text" id="text2">
+ </div>
+</body>
+<script>
+async_test(t => {
+ let text1 = document.getElementById("text1");
+ let text2 = document.getElementById("text2");
+ text1.addEventListener("click", function() {
+ let text1 = document.getElementById("text1");
+ text1.value="new text";
+ });
+
+ const ctrl_key = "\uE009";
+ const cmd_key = "\uE03D";
+ let edit_command_key = ctrl_key;
+ if(navigator.platform.includes('Mac'))
+ edit_command_key = cmd_key;
+
+ let actions = new test_driver.Actions()
+ .pointerMove(0, 0, {origin: text1})
+ .pointerDown()
+ .pointerUp()
+ .addTick()
+ .keyDown(edit_command_key)
+ .keyDown("a")
+ .keyUp("a")
+ .keyDown("x")
+ .keyUp("x")
+ .keyUp(edit_command_key)
+ .addTick()
+ .pointerMove(0, 0, {origin: text2})
+ .pointerDown()
+ .pointerUp()
+ .keyDown(edit_command_key)
+ .keyDown("v")
+ .keyUp("v")
+ .keyUp(edit_command_key);
+
+ actions.send()
+ .then(t.step_func_done(() => {
+ assert_equals(text1.value, "");
+ assert_equals(text2.value, "new text");
+ }))
+ .catch(e => t.step_func(() => assert_unreached("Actions sequence failed " + e)));
+});
+</script>