Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: LayoutTests/fast/dom/HTMLInputElement/input-value-null.html

Issue 372543002: Use [TreatNullAs=EmptyString] for HTMLInputElement.value (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: testcase style adjustment Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/dom/HTMLInputElement/input-value-null-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/testharness.js"></script>
5 <script src="../../../resources/testharnessreport.js"></script>
6 <link rel="stylesheet" href="../../../resources/testharness.css">
7 </head>
8 <body>
9 <p>This test checks that assigning null to HTMLInputElement.value behaves
10 correctly; i.e. as if the empty string was assigned.</p>
11 <form style="display: none">
12 <input id="text-with-default" type="text" value="default">
13 <input id="text-without-default" type="text">
14 <input id="hidden" type="hidden" value="value">
15 </form>
16 <script>
17
18 test(function () {
19 var input = document.getElementById("text-with-default");
20
21 assert_equals(input.value, "default");
22 assert_equals(input.getAttribute("value"), "default");
23
24 input.value = "custom";
25
26 assert_equals(input.value, "custom");
27 assert_equals(input.getAttribute("value"), "default");
28
29 input.value = null;
30
31 assert_equals(input.value, "");
32 assert_true(input.hasAttribute("value"));
33 }, "input[type=text] with value content attribute.");
34
35 test(function () {
36 var input = document.getElementById("text-without-default");
37
38 assert_equals(input.value, "");
39 assert_false(input.hasAttribute("value"));
40
41 input.value = null;
42
43 assert_equals(input.value, "");
44 assert_false(input.hasAttribute("value"));
45 }, "input[type=text] without value content attribute.");
46
47 test(function () {
48 var input = document.getElementById("hidden");
49
50 assert_equals(input.value, "value");
51 assert_equals(input.getAttribute("value"), "value");
52
53 input.value = null;
54
55 assert_equals(input.value, "");
56 assert_true(input.hasAttribute("value"));
57 assert_equals(input.getAttribute("value"), "");
58 }, "input[type=hidden] with value content attribute.");
59
60 </script>
61 </body>
62 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/HTMLInputElement/input-value-null-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698