blob: 583659a0234efd65342077cdd0cfbaf63aabd624 [file] [log] [blame]
<html>
<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>
<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/>
</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/>
</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/>
</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/>
</div>
</div>
<script>
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);
}
// 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();
debug("id=" + id + " type=" + inputElement.type + " spellcheck=" + inputElement.spellcheck
+ " parent's spellcheck=" + inputElement.parentNode.spellcheck);
shouldBeMarked = isMisspelled;
shouldBecomeEqual('internals.hasSpellingMarker(document, 0, 2)', 'shouldBeMarked', done);
}
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); },
];
function done()
{
var next = tests.shift();
if (next)
return window.setTimeout(next, 0);
if (window.testRunner) {
// Cleaning up for expectation text if running on DRT.
document.getElementById("testRoot").style.display = "none";
}
finishJSTest();
}
done();
</script>
</body>
</html>