Index: LayoutTests/editing/spelling/spellcheck-attribute.html |
diff --git a/LayoutTests/editing/spelling/spellcheck-attribute.html b/LayoutTests/editing/spelling/spellcheck-attribute.html |
index 6bbaa4c34465ba1e6a5402acc9631d631390ca2e..583659a0234efd65342077cdd0cfbaf63aabd624 100644 |
--- a/LayoutTests/editing/spelling/spellcheck-attribute.html |
+++ b/LayoutTests/editing/spelling/spellcheck-attribute.html |
@@ -2,10 +2,11 @@ |
<head> |
<title>Spellcheck Attribute Test</title> |
<link rel="help" href="http://damowmow.com/playground/spellcheck.txt"> |
+<script src="../editing.js"></script> |
+<script src="resources/util.js"></script> |
<script src="../../resources/js-test.js"></script> |
</head> |
<body> |
-<p>This tests if the "spellcheck" attribute is implemented as written in its specification. If this test succeeds, you can see forms filled with an invalid word 'zz '. Nevertheless, the 'zz ' is not marked as misspelled in all of them. |
<div id="testRoot"> |
<div spellcheck="true"> |
@@ -14,7 +15,6 @@ |
<label>1.3.</label><input id="test1_3" type="text" spellcheck="false"></input><br/> |
<label>1.4.</label><input id="test1_4" type="text" spellcheck="InvalidValue"></input><br/> |
<label>1.5.</label><input id="test1_5" type="text" spellcheck></input><br/> |
-<label>1.6.</label><input id="test1_6" type="text"></input><br/> |
</div> |
<div spellcheck="false"> |
<label>2.1.</label><input id="test2_1" type="text"></input><br/> |
@@ -22,7 +22,6 @@ |
<label>2.3.</label><input id="test2_3" type="text" spellcheck="false"></input><br/> |
<label>2.4.</label><input id="test2_4" type="text" spellcheck="InvalidValue"></input><br/> |
<label>2.5.</label><input id="test2_5" type="text" spellcheck></input><br/> |
-<label>2.6.</label><input id="test2_6" type="text"></input><br/> |
</div> |
<div spellcheck="true"> |
@@ -31,7 +30,6 @@ |
<label>3.3.</label><input id="test3_3" type="search" spellcheck="false"></input><br/> |
<label>3.4.</label><input id="test3_4" type="search" spellcheck="InvalidValue"></input><br/> |
<label>3.5.</label><input id="test3_5" type="search" spellcheck></input><br/> |
-<label>3.6.</label><input id="test3_6" type="search"></input><br/> |
</div> |
<div spellcheck="false"> |
<label>4.1.</label><input id="test4_1" type="search"></input><br/> |
@@ -39,64 +37,82 @@ |
<label>4.3.</label><input id="test4_3" type="search" spellcheck="false"></input><br/> |
<label>4.4.</label><input id="test4_4" type="search" spellcheck="InvalidValue"></input><br/> |
<label>4.5.</label><input id="test4_5" type="search" spellcheck></input><br/> |
-<label>4.6.</label><input id="test4_6" type="search"></input><br/> |
</div> |
</div> |
-<pre id="console"></pre> |
<script> |
-function log(msg) { |
- document.getElementById("console").innerHTML += (msg + "\n"); |
+description('This tests if the "spellcheck" attribute is implemented ' |
+ + 'as written in its specification. If this test succeeds, you can see ' |
+ + 'forms filled with an invalid word "zz". Nevertheless, the "zz" is not ' |
+ + 'marked as misspelled in all of them.'); |
+ |
+jsTestIsAsync = true; |
+ |
+if (window.internals) { |
+ internals.settings.setUnifiedTextCheckerEnabled(true); |
+ internals.settings.setAsynchronousSpellCheckingEnabled(true); |
} |
-function testMarkerForMisspelledWord(id, shouldBeMarked) { |
+// Type misspelling to all input elements. |
+var inputs = document.getElementsByTagName('input'); |
+for (var i = 0; i < inputs.length; i++) |
+ typeText(inputs[i], 'zz '); |
+ |
+var shouldBeMarked; |
+ |
+function testMarkerForMisspelledWord(id, isMisspelled) { |
+ if (!window.internals) |
+ return done(); |
+ |
var inputElement = document.getElementById(id); |
+ // Spelling markers for input will appear if it's focused. |
inputElement.focus(); |
- document.execCommand("InsertText", false, 'z'); |
- document.execCommand("InsertText", false, 'z'); |
- document.execCommand("InsertText", false, ' '); |
- log("id=" + id + " type=" + inputElement.type + " spellcheck=" + inputElement.spellcheck |
+ debug("id=" + id + " type=" + inputElement.type + " spellcheck=" + inputElement.spellcheck |
+ " parent's spellcheck=" + inputElement.parentNode.spellcheck); |
- shouldBe("internals.hasSpellingMarker(document, 0, 2)", shouldBeMarked ? "true" : "false") |
+ shouldBeMarked = isMisspelled; |
+ shouldBecomeEqual('internals.hasSpellingMarker(document, 0, 2)', 'shouldBeMarked', done); |
} |
-// For type="text". |
-testMarkerForMisspelledWord('test1_1', true); |
-testMarkerForMisspelledWord('test1_2', true); |
-testMarkerForMisspelledWord('test1_3', false); |
-testMarkerForMisspelledWord('test1_4', true); |
-testMarkerForMisspelledWord('test1_5', true); |
-testMarkerForMisspelledWord('test1_6', true); |
-log(""); |
-testMarkerForMisspelledWord('test2_1', false); |
-testMarkerForMisspelledWord('test2_2', true); |
-testMarkerForMisspelledWord('test2_3', false); |
-testMarkerForMisspelledWord('test2_4', false); |
-testMarkerForMisspelledWord('test2_5', true); |
-testMarkerForMisspelledWord('test2_6', false); |
-log(""); |
+var tests = [ |
+ // For type="text". |
+ function() { testMarkerForMisspelledWord('test1_1', true); }, |
+ function() { testMarkerForMisspelledWord('test1_2', true); }, |
+ function() { testMarkerForMisspelledWord('test1_3', false); }, |
+ function() { testMarkerForMisspelledWord('test1_4', true); }, |
+ function() { testMarkerForMisspelledWord('test1_5', true); }, |
+ function() { testMarkerForMisspelledWord('test2_1', false); }, |
+ function() { testMarkerForMisspelledWord('test2_2', true); }, |
+ function() { testMarkerForMisspelledWord('test2_3', false); }, |
+ function() { testMarkerForMisspelledWord('test2_4', false); }, |
+ function() { testMarkerForMisspelledWord('test2_5', true); }, |
+ // For type="search". |
+ function() { testMarkerForMisspelledWord('test3_1', true); }, |
+ function() { testMarkerForMisspelledWord('test3_2', true); }, |
+ function() { testMarkerForMisspelledWord('test3_3', false); }, |
+ function() { testMarkerForMisspelledWord('test3_4', true); }, |
+ function() { testMarkerForMisspelledWord('test3_5', true); }, |
+ function() { testMarkerForMisspelledWord('test4_1', false); }, |
+ function() { testMarkerForMisspelledWord('test4_2', true); }, |
+ function() { testMarkerForMisspelledWord('test4_3', false); }, |
+ function() { testMarkerForMisspelledWord('test4_4', false); }, |
+ function() { testMarkerForMisspelledWord('test4_5', true); }, |
+]; |
-// For type="search". |
-testMarkerForMisspelledWord('test3_1', true); |
-testMarkerForMisspelledWord('test3_2', true); |
-testMarkerForMisspelledWord('test3_3', false); |
-testMarkerForMisspelledWord('test3_4', true); |
-testMarkerForMisspelledWord('test3_5', true); |
-testMarkerForMisspelledWord('test3_6', true); |
-log(""); |
-testMarkerForMisspelledWord('test4_1', false); |
-testMarkerForMisspelledWord('test4_2', true); |
-testMarkerForMisspelledWord('test4_3', false); |
-testMarkerForMisspelledWord('test4_4', false); |
-testMarkerForMisspelledWord('test4_5', true); |
-testMarkerForMisspelledWord('test4_6', false); |
+function done() |
+{ |
+ var next = tests.shift(); |
+ if (next) |
+ return window.setTimeout(next, 0); |
-if (window.testRunner) { |
- // Cleaning up for expeation text if running on DRT. |
- document.getElementById("testRoot").style.display = "none"; |
+ if (window.testRunner) { |
+ // Cleaning up for expectation text if running on DRT. |
+ document.getElementById("testRoot").style.display = "none"; |
+ } |
+ finishJSTest(); |
} |
+done(); |
</script> |
</body> |
</html> |