blob: da49073916cf2644f559547ab64e70f498eff900 [file] [log] [blame]
<html>
<head>
<title>Spellcheck Attribute Test</title>
<link rel="help" href="http://damowmow.com/playground/spellcheck.txt">
<script src="../../resources/js-test-pre.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">
<label>1.1.</label><input id="test1_1" type="text"></input><br/>
<label>1.2.</label><input id="test1_2" type="text" spellcheck="true"></input><br/>
<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/>
<label>2.2.</label><input id="test2_2" type="text" spellcheck="true"></input><br/>
<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">
<label>3.1.</label><input id="test3_1" type="search"></input><br/>
<label>3.2.</label><input id="test3_2" type="search" spellcheck="true"></input><br/>
<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/>
<label>4.2.</label><input id="test4_2" type="search" spellcheck="true"></input><br/>
<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");
}
function testMarkerForMisspelledWord(id, shouldBeMarked) {
var inputElement = document.getElementById(id);
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
+ " parent's spellcheck=" + inputElement.parentNode.spellcheck);
shouldBe("internals.hasSpellingMarker(0, 2)", shouldBeMarked ? "true" : "false")
}
// 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("");
// 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);
if (window.testRunner) {
// Cleaning up for expeation text if running on DRT.
document.getElementById("testRoot").style.display = "none";
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>