Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix defaultValue-clobbering.html #25442

Merged
merged 1 commit into from
Sep 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<!DOCTYPE html>
<html class="reftest-wait">
<meta charset="utf-8">
<link rel="author" title="Joey Arhar" href="mailto:jarhar@chromium.org">
<link rel="match" href="defaultValue-clobbering-ref.html">
<meta name="assert" content="Assigning to defaultValue does not modify text a user has already typed in.">

<!-- This behavior is not explicitly specified. -->

<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>
<script src="/resources/testdriver-actions.js"></script>

<div>
email with leading whitespace: <input id=emailinput type=email>
Expand All @@ -19,13 +18,19 @@
</div>

<script>
window.onload = async () => {
promise_test(async () => {
await test_driver.send_keys(emailinput, ' user');
await test_driver.send_keys(numberinput, '123e');
assert_false(emailinput.validity.valid, '" user" should not be a valid value for type=email.');

emailinput.defaultValue = emailinput.value;
numberinput.defaultValue = numberinput.value;
assert_false(emailinput.validity.valid, 'Assigning to defaultValue should not affect input.validity.');
}, 'Visible value and validity should not be affected when assigning to the defaultValue property for type=email.');

document.documentElement.classList.remove('reftest-wait');
};
promise_test(async () => {
await test_driver.send_keys(numberinput, '123e');
assert_false(numberinput.validity.valid, '"123e" should not be a valid value for type=number.');

numberinput.defaultValue = numberinput.value;
assert_false(numberinput.validity.valid, 'Assigning to defaultValue should not affect input.validity.');
}, 'Visible value and validity should not be affected when assigning to the defaultValue property for type=number.');
</script>