Chromium Code Reviews| 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..d1106962264fa9f8ee1235919ab3a40c1cd792fa |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-attribute-settings-default.html |
| @@ -0,0 +1,79 @@ |
| +<html> |
|
Rick Byers
2016/09/26 18:44:34
nit: html, head and body tags are normally omitted
timvolodine
2016/09/27 17:51:56
yes hmm, however it appears all spellcheck related
|
| +<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> |