| Index: third_party/WebKit/LayoutTests/editing/spelling/spellcheck-attribute-settings-default.html
|
| diff --git a/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-attribute-settings-default.html b/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-attribute-settings-default.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..bdfc373b314ec26d1e53d1721c1b786260a4f08c
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-attribute-settings-default.html
|
| @@ -0,0 +1,80 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<head>
|
| +<title>Spellcheck Attribute Settings Default Test</title>
|
| +<script src="../editing.js"></script>
|
| +<script src="resources/util.js"></script>
|
| +<script src="../../resources/js-test.js"></script>
|
| +</head>
|
| +<body>
|
| +<div id="testRoot">
|
| +<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>
|
| +<script>
|
| +description('This tests that the spellcheck default value is as specified in '
|
| + + 'internal blink settings. This allows embedders to specify spellchecking '
|
| + + 'behavior when the spellcheck attribute is not explicitly set.');
|
| +
|
| +jsTestIsAsync = true;
|
| +if (window.testRunner)
|
| + testRunner.setMockSpellCheckerEnabled(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, enabled_by_default) {
|
| + if (!window.internals)
|
| + return done();
|
| +
|
| + internals.settings.setSpellCheckEnabledByDefault(enabled_by_default);
|
| +
|
| + 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 + " enabled_by_default=" + enabled_by_default);
|
| +
|
| + shouldBeMarked = isMisspelled;
|
| + shouldBecomeEqual('internals.hasSpellingMarker(document, 0, 2)', 'shouldBeMarked', done);
|
| +}
|
| +
|
| +var tests = [
|
| + // spellcheck enabled by default
|
| + function() { testMarkerForMisspelledWord('test1_1', true, true); },
|
| + function() { testMarkerForMisspelledWord('test1_2', true, true); },
|
| + function() { testMarkerForMisspelledWord('test1_3', false, true); },
|
| + function() { testMarkerForMisspelledWord('test1_4', true, true); },
|
| + function() { testMarkerForMisspelledWord('test1_5', true, true); },
|
| + // spellcheck disabled by default
|
| + function() { testMarkerForMisspelledWord('test1_1', false, false); },
|
| + function() { testMarkerForMisspelledWord('test1_2', true, false); },
|
| + function() { testMarkerForMisspelledWord('test1_3', false, false); },
|
| + function() { testMarkerForMisspelledWord('test1_4', false, false); },
|
| + function() { testMarkerForMisspelledWord('test1_5', false, false); },
|
| +];
|
| +
|
| +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>
|
|
|