mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 19:45:12 +00:00
Tests: Add vendor-specific testdriver send_keys()
function
This uses the `Internals.sendText()` function.
This commit is contained in:
parent
1bd10a5443
commit
a536ee6f31
Notes:
github-actions[bot]
2024-12-11 08:49:18 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/a536ee6f318 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2868 Reviewed-by: https://github.com/trflynn89
3 changed files with 34 additions and 0 deletions
|
@ -0,0 +1,6 @@
|
|||
Harness status: OK
|
||||
|
||||
Found 1 tests
|
||||
|
||||
1 Pass
|
||||
Pass TestDriver send keys method
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>TestDriver send keys method</title>
|
||||
<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>
|
||||
|
||||
<input type="text" id="text">Text Input</button>
|
||||
|
||||
<script>
|
||||
async_test(t => {
|
||||
let input_text = "Hello, wpt!";
|
||||
let text_box = document.getElementById("text");
|
||||
test_driver
|
||||
.send_keys(text_box, input_text)
|
||||
.then(() => {
|
||||
assert_equals(text_box.value, input_text);
|
||||
t.done();
|
||||
})
|
||||
.catch(t.unreached_func("send keys failed"));
|
||||
});
|
||||
</script>
|
|
@ -8,6 +8,11 @@ window.test_driver_internal.click = function(element) {
|
|||
return Promise.resolve();
|
||||
};
|
||||
|
||||
window.test_driver_internal.send_keys = function(element, keys) {
|
||||
window.internals.sendText(element, keys);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
window.test_driver_internal.get_computed_label = async function(element) {
|
||||
return await window.internals.getComputedLabel(element);
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue