OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Hidden input element</title> |
| 5 <link rel="author" title="Kinuko Yasuda" href="mailto:kinuko@chromium.org"> |
| 6 <link rel="help" href="https://html.spec.whatwg.org/multipage/#hidden-state-
(type=hidden)"> |
| 7 <script src="../../../../../../resources/testharness.js"></script> |
| 8 <script src="../../../../../../resources/testharnessreport.js"></script> |
| 9 </head> |
| 10 |
| 11 <body> |
| 12 <h1>Hidden input element</h1> |
| 13 <div style="display: none"> |
| 14 |
| 15 <input id="hidden" type="hidden" /> |
| 16 <input id="hidden_with_value" type="hidden" value="foo" /> |
| 17 |
| 18 </div> |
| 19 <div id="log"></div> |
| 20 <script type="text/javascript"> |
| 21 |
| 22 test( |
| 23 function() { |
| 24 assert_equals(document.getElementById("hidden").value, ""); |
| 25 assert_equals(document.getElementById("hidden_with_value").value, "foo")
; |
| 26 }, "Value returns the current value for hidden"); |
| 27 |
| 28 test( |
| 29 function() { |
| 30 document.getElementById("hidden").value = "A"; |
| 31 assert_equals(document.getElementById("hidden").value, "A"); |
| 32 document.getElementById("hidden").value = "B"; |
| 33 assert_equals(document.getElementById("hidden").value, "B"); |
| 34 }, "Setting value changes the current value for hidden"); |
| 35 |
| 36 test( |
| 37 function() { |
| 38 assert_equals(document.getElementById("hidden").files, null); |
| 39 }, "files attribute must return null for hidden"); |
| 40 |
| 41 test( |
| 42 function() { |
| 43 assert_equals(document.getElementById("hidden").valueAsDate, null); |
| 44 }, "valueAsDate attribute must return null for hidden"); |
| 45 |
| 46 test( |
| 47 function() { |
| 48 assert_equals(document.getElementById("hidden").valueAsNumber, NaN); |
| 49 }, "valueAsNumber attribute must return NaN for hidden"); |
| 50 |
| 51 test( |
| 52 function() { |
| 53 assert_equals(document.getElementById("hidden").list, null); |
| 54 }, "list attribute must return null for hidden"); |
| 55 |
| 56 test( |
| 57 function() { |
| 58 var el = document.getElementById("hidden"); |
| 59 assert_throws("InvalidStateError", function() { el.stepDown(); }, ""); |
| 60 }, "stepDown does not apply for hidden"); |
| 61 |
| 62 test( |
| 63 function() { |
| 64 var el = document.getElementById("hidden"); |
| 65 assert_throws("InvalidStateError", function() { el.stepUp(); }, ""); |
| 66 }, "stepUp does not apply for hidden"); |
| 67 |
| 68 test(function(){ |
| 69 var el = document.getElementById("hidden"); |
| 70 assert_false(el.willValidate); |
| 71 }, "input type=hidden is barred from constraint validation"); |
| 72 </script> |
| 73 </body> |
| 74 </html> |
OLD | NEW |