Chromium Code Reviews| Index: LayoutTests/editing/spelling/script-tests/spelling-attribute-change.js |
| diff --git a/LayoutTests/editing/spelling/script-tests/spelling-attribute-change.js b/LayoutTests/editing/spelling/script-tests/spelling-attribute-change.js |
| index ff4eaa7b76fba3e1121bc105e789559f42ea8312..56be20d22ca22337174705a4277ce325155b64a8 100644 |
| --- a/LayoutTests/editing/spelling/script-tests/spelling-attribute-change.js |
| +++ b/LayoutTests/editing/spelling/script-tests/spelling-attribute-change.js |
| @@ -1,5 +1,12 @@ |
| description('Tests if the spellchecker behavior change after the spellcheck attribute changed by the script.'); |
| +jsTestIsAsync = true; |
| + |
| +if (window.internals) { |
| + internals.settings.setUnifiedTextCheckerEnabled(true); |
| + internals.settings.setAsynchronousSpellCheckingEnabled(true); |
| +} |
| + |
| var parent = document.createElement("div"); |
| document.body.appendChild(parent); |
| var sel = document.getSelection(); |
| @@ -22,7 +29,10 @@ function testSpellCheckingEnabled(target, enabled) |
| window.target = target; |
| shouldBe("target.spellcheck", enabled ? "true" : "false"); |
| - shouldBe("internals.hasSpellingMarker(document, 6, 2)", enabled ? "true" : "false"); |
| + if (window.internals) |
| + shouldBecomeEqual("internals.hasSpellingMarker(document, 6, 2)", enabled ? "true" : "false", done); |
| + else |
| + done(); |
| } |
| function createElement(tagName, spellcheck) |
| @@ -41,46 +51,39 @@ function testFor(tagName, initialAttribute, expectation) |
| parent.appendChild(target); |
| testSpellCheckingEnabled(target, expectation); |
| - parent.innerHTML = ""; |
| } |
| -// default -> true |
| -testFor("SPAN", undefined, true); |
| -// default -> false |
| -testFor("SPAN", undefined, false); |
| -// true -> true |
| -testFor("SPAN", true, true); |
| -// true -> false |
| -testFor("SPAN", true, false); |
| -// false -> true |
| -testFor("SPAN", false, true); |
| -// false -> false |
| -testFor("SPAN", false, false); |
| - |
| -// default -> true |
| -testFor("INPUT", undefined, true); |
| -// default -> false |
| -testFor("INPUT", undefined, false); |
| -// true -> true |
| -testFor("INPUT", true, true); |
| -// true -> false |
| -testFor("INPUT", true, false); |
| -// false -> true |
| -testFor("INPUT", false, true); |
| -// false -> false |
| -testFor("INPUT", false, false); |
| - |
| -// default -> true |
| -testFor("TEXTAREA", undefined, true); |
| -// default -> false |
| -testFor("TEXTAREA", undefined, false); |
| -// true -> true |
| -testFor("TEXTAREA", true, true); |
| -// true -> false |
| -testFor("TEXTAREA", true, false); |
| -// false -> true |
| -testFor("TEXTAREA", false, true); |
| -// false -> false |
| -testFor("TEXTAREA", false, false); |
| +var tests = [ |
| + function() { testFor("SPAN", undefined, true); }, // default -> true |
| + function() { testFor("SPAN", undefined, false); }, // default -> false |
| + function() { testFor("SPAN", true, true); }, // true -> true |
|
tony
2014/03/10 17:07:56
I'm not sure there's a lot of value to these comme
groby-ooo-7-16
2014/03/10 20:14:09
And while you're simplifying: The testFor function
grzegorz
2014/03/11 13:24:32
Thanks. Please have a look at patch #2 if I proper
|
| + function() { testFor("SPAN", true, false); }, // true -> false |
| + function() { testFor("SPAN", false, true); }, // false -> true |
| + function() { testFor("SPAN", false, false); }, // false -> false |
| + |
| + function() { testFor("INPUT", undefined, true); }, // default -> true |
| + function() { testFor("INPUT", undefined, false); }, // default -> false |
| + function() { testFor("INPUT", true, true); }, // true -> true |
| + function() { testFor("INPUT", true, false); }, // true -> false |
| + function() { testFor("INPUT", false, true); }, // false -> true |
| + function() { testFor("INPUT", false, false); }, // false -> false |
| + |
| + function() { testFor("TEXTAREA", undefined, true); }, // default -> true |
| + function() { testFor("TEXTAREA", undefined, false); }, // default -> false |
| + function() { testFor("TEXTAREA", true, true); }, // true -> true |
| + function() { testFor("TEXTAREA", true, false); }, // true -> false |
| + function() { testFor("TEXTAREA", false, true); }, // false -> true |
| + function() { testFor("TEXTAREA", false, false); }, // false -> false |
| +]; |
| + |
| +function done() |
| +{ |
| + var next = tests.shift(); |
| + if (next) |
| + return setTimeout(next, 0); |
| + |
| + finishJSTest(); |
| +} |
| +done(); |
| var successfullyParsed = true; |