| Index: LayoutTests/fast/dom/HTMLInputElement/input-value-null.html
|
| diff --git a/LayoutTests/fast/dom/HTMLInputElement/input-value-null.html b/LayoutTests/fast/dom/HTMLInputElement/input-value-null.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5e33ecde1784aa90c85fb7d254a8e3d8e960b2be
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/dom/HTMLInputElement/input-value-null.html
|
| @@ -0,0 +1,62 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<head>
|
| +<script src="../../../resources/testharness.js"></script>
|
| +<script src="../../../resources/testharnessreport.js"></script>
|
| +<link rel="stylesheet" href="../../../resources/testharness.css">
|
| +</head>
|
| +<body>
|
| +<p>This test checks that assigning null to HTMLInputElement.value behaves
|
| + correctly; i.e. as if the empty string was assigned.</p>
|
| +<form style="display: none">
|
| +<input id="text-with-default" type="text" value="default">
|
| +<input id="text-without-default" type="text">
|
| +<input id="hidden" type="hidden" value="value">
|
| +</form>
|
| +<script>
|
| +
|
| +test(function () {
|
| + var input = document.getElementById("text-with-default");
|
| +
|
| + assert_equals(input.value, "default");
|
| + assert_equals(input.getAttribute("value"), "default");
|
| +
|
| + input.value = "custom";
|
| +
|
| + assert_equals(input.value, "custom");
|
| + assert_equals(input.getAttribute("value"), "default");
|
| +
|
| + input.value = null;
|
| +
|
| + assert_equals(input.value, "");
|
| + assert_true(input.hasAttribute("value"));
|
| +}, "input[type=text] with value content attribute.");
|
| +
|
| +test(function () {
|
| + var input = document.getElementById("text-without-default");
|
| +
|
| + assert_equals(input.value, "");
|
| + assert_false(input.hasAttribute("value"));
|
| +
|
| + input.value = null;
|
| +
|
| + assert_equals(input.value, "");
|
| + assert_false(input.hasAttribute("value"));
|
| +}, "input[type=text] without value content attribute.");
|
| +
|
| +test(function () {
|
| + var input = document.getElementById("hidden");
|
| +
|
| + assert_equals(input.value, "value");
|
| + assert_equals(input.getAttribute("value"), "value");
|
| +
|
| + input.value = null;
|
| +
|
| + assert_equals(input.value, "");
|
| + assert_true(input.hasAttribute("value"));
|
| + assert_equals(input.getAttribute("value"), "");
|
| +}, "input[type=hidden] with value content attribute.");
|
| +
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|