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-input-element/email-set-value.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>Input Email setValue</title>
<link rel="author" href="mailto:atotic@chromium.org">
<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>
<input type="email">
<script>
promise_test(async () => {
let input = document.querySelector("input");
let unsanitized = ' foo@bar ';
let sanitized = unsanitized.trim();
await test_driver.send_keys(input, unsanitized);
input.select();
assert_equals(input.value, sanitized, "value is sanitized");
assert_equals(window.getSelection().toString(), unsanitized,
"visible value is unsanitized");
input.value = sanitized;
input.select();
assert_equals(window.getSelection().toString(), sanitized,
"visible value is sanitized after setValue(sanitized)");
},
"setValue(sanitizedValue) is reflected in visible text field content");
</script>