| Index: third_party/WebKit/LayoutTests/fast/dom/HTMLElement/spellcheck.html
|
| diff --git a/third_party/WebKit/LayoutTests/fast/dom/HTMLElement/spellcheck.html b/third_party/WebKit/LayoutTests/fast/dom/HTMLElement/spellcheck.html
|
| index dc79b13d7bfa515b7a02ab8482185774ea6751ec..9e2429a59d54994ad16b7878bfc64a3f99143b56 100644
|
| --- a/third_party/WebKit/LayoutTests/fast/dom/HTMLElement/spellcheck.html
|
| +++ b/third_party/WebKit/LayoutTests/fast/dom/HTMLElement/spellcheck.html
|
| @@ -4,6 +4,107 @@
|
| <script src="../../../resources/js-test.js"></script>
|
| </head>
|
| <body>
|
| -<script src="script-tests/spellcheck.js"></script>
|
| +<script>
|
| +description('Tests the spellcheck attribute.');
|
| +
|
| +var parent = document.createElement("div");
|
| +document.body.appendChild(parent);
|
| +
|
| +function testFor(initialAttribute, initialExpectation, setValue, lastExpectation, lastAttributeExpectation)
|
| +{
|
| + var target = document.createElement("span");
|
| + parent.appendChild(target);
|
| +
|
| + window.target = target;
|
| + window.initialExpectation = initialExpectation;
|
| + window.lastExpectation = lastExpectation;
|
| + window.lastAttributeExpectation = lastAttributeExpectation;
|
| +
|
| + if (undefined !== initialAttribute)
|
| + target.setAttribute("spellcheck", initialAttribute);
|
| + shouldBe("target.spellcheck", "initialExpectation");
|
| +
|
| + if (undefined !== setValue)
|
| + target.spellcheck = setValue;
|
| + shouldBe("target.spellcheck", "lastExpectation");
|
| + shouldBe("target.getAttribute('spellcheck')", "lastAttributeExpectation");
|
| +
|
| + parent.removeChild(target);
|
| +}
|
| +
|
| +function testUsingSetAttributes()
|
| +{
|
| + var target = document.createElement("span");
|
| + parent.appendChild(target);
|
| + window.target = target;
|
| +
|
| + shouldBe("target.spellcheck", "true");
|
| + shouldBe("target.getAttribute('spellcheck')", "'true'");
|
| + // Set using property.
|
| + target.spellcheck = false;
|
| + shouldBe("target.spellcheck", "false");
|
| + shouldBe("target.getAttribute('spellcheck')", "'false'");
|
| + // Set using setAttribute().
|
| + target.setAttribute("spellcheck", "true");
|
| + shouldBe("target.spellcheck", "true");
|
| + shouldBe("target.getAttribute('spellcheck')", "'true'");
|
| +
|
| + // Set using setAttribute(), valid but non canonical value.
|
| + target.spellcheck = false; // clear at first
|
| + target.setAttribute("spellcheck", "TRUE");
|
| + shouldBe("target.spellcheck", "true");
|
| + shouldBe("target.getAttribute('spellcheck')", "'TRUE'");
|
| + // Set using setAttribute(), invalid value.
|
| + target.spellcheck = false; // clear at first
|
| + target.setAttribute("spellcheck", "INVALID");
|
| + shouldBe("target.spellcheck", "true");
|
| + shouldBe("target.getAttribute('spellcheck')", "'INVALID'");
|
| +
|
| + parent.removeChild(target);
|
| +}
|
| +
|
| +testFor(undefined, true, undefined, true, null);
|
| +testFor(undefined, true, false, false, "false");
|
| +testFor(undefined, true, true, true, "true");
|
| +testFor(undefined, true, 0, false, "false"); // 0 will be coerced to false
|
| +testFor(undefined, true, 1, true, "true"); // 0 will be coerced to true
|
| +testFor(undefined, true, "invalid", true, "true"); // string will be coerced to true
|
| +testFor(undefined, true, "false", true, "true"); // ...even if the string is "false" (as Firefox does).
|
| +
|
| +testFor("true", true, undefined, true, "true");
|
| +testFor("true", true, false, false, "false");
|
| +testFor("true", true, true, true, "true");
|
| +testFor("true", true, 0, false, "false");
|
| +testFor("true", true, 1, true, "true");
|
| +testFor("true", true, "invalid", true, "true");
|
| +testFor("true", true, "false", true, "true");
|
| +
|
| +testFor("false", false, undefined, false, "false");
|
| +testFor("false", false, false, false, "false");
|
| +testFor("false", false, true, true, "true");
|
| +testFor("false", false, 0, false, "false");
|
| +testFor("false", false, 1, true, "true");
|
| +testFor("false", false, "invalid", true, "true");
|
| +testFor("false", false, "false", true, "true");
|
| +
|
| +// various initial values
|
| +testFor("", true, undefined, true, "");
|
| +testFor("", true, 1, true, "true");
|
| +testFor("TRUE", true, undefined, true, "TRUE");
|
| +testFor("TRUE", true, 1, true, "true");
|
| +testFor("FALSE", false, undefined, false, "FALSE");
|
| +testFor("FALSE", false, 0, false, "false");
|
| +testFor("invalid", true, undefined, true, "invalid");
|
| +testFor("invalid", true, 1, true, "true");
|
| +testFor("false ", true, undefined, true, "false ");
|
| +testFor("false ", true, 1, true, "true");
|
| +testFor("false ", true, 0, false, "false");
|
| +testFor("0", true, undefined, true, "0");
|
| +testFor("0", true, 0, false, "false");
|
| +testFor("1", true, undefined, true, "1");
|
| +testFor("1", true, 0, false, "false");
|
| +
|
| +testUsingSetAttributes();
|
| +</script>
|
| </body>
|
| </html>
|
|
|