Index: third_party/WebKit/LayoutTests/editing/spelling/spellcheck-paste-continuous-disabled.html |
diff --git a/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-paste-continuous-disabled.html b/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-paste-continuous-disabled.html |
index 0fa9f1f6a4e4ac1fae05e5235cfcf3cc730abe0a..a6d58d0f3ae655d9179a2a452a8af80a8d16ee85 100644 |
--- a/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-paste-continuous-disabled.html |
+++ b/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-paste-continuous-disabled.html |
@@ -1,39 +1,49 @@ |
<!DOCTYPE HTML> |
<html> |
<head> |
-<script src="../../resources/js-test.js"></script> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script src="resources/util.js"></script> |
</head> |
<body> |
<div> |
-<div id="src" contenteditable="true" spellcheck="true"></div> |
+<div id="src" contenteditable></div><br/> |
</div> |
-<script language="javascript"> |
-description('Test if WebKit does not spellcheck text when pasting text and continuous spellcheck is turned off. ' + |
- 'To test manually, disable continuous spellcheck, copy the text "zz apple" and paste it to the textarea. ' + |
- 'When "zz" is not marked as misspelled, this test succeeds.'); |
- |
-jsTestIsAsync = true; |
- |
-// Insert a misspelled word to initialize a spellchecker. |
+<script> |
var srcNode = document.getElementById('src'); |
-srcNode.focus(); |
-document.execCommand("InsertText", false, 'z'); |
-document.execCommand("InsertText", false, 'z'); |
-document.execCommand("InsertText", false, ' '); |
-document.execCommand("InsertText", false, 'a'); |
-document.execCommand("InsertText", false, 'p'); |
-document.execCommand("InsertText", false, 'p'); |
-document.execCommand("InsertText", false, 'l'); |
-document.execCommand("InsertText", false, 'e'); |
-shouldBecomeEqual('internals.hasSpellingMarker(document, 0, 2)', 'true', function() {}); |
-window.getSelection().selectAllChildren(srcNode); |
-document.execCommand('Copy'); |
-internals.setContinuousSpellCheckingEnabled(false); |
+steps = [ |
+ // Insert a misspelled word to initialize a spellchecker. |
+ // Break the insertion of 'zz apple' into two parts to wait for the spelling |
+ // markers under 'zz' to appear. |
+ function() { |
+ srcNode.focus(); |
+ document.execCommand('InsertText', false, 'z'); |
+ document.execCommand('InsertText', false, 'z'); |
+ document.execCommand('InsertText', false, ' '); |
+ }, |
+ function() { |
+ document.execCommand('InsertText', false, 'a'); |
+ document.execCommand('InsertText', false, 'p'); |
+ document.execCommand('InsertText', false, 'p'); |
+ document.execCommand('InsertText', false, 'l'); |
+ document.execCommand('InsertText', false, 'e'); |
+ }, |
+ function() { |
+ window.getSelection().selectAllChildren(srcNode); |
+ document.execCommand('Copy'); |
+ internals.setContinuousSpellCheckingEnabled(false); |
+ document.execCommand('Paste'); |
+ } |
+]; |
-document.execCommand('Paste'); |
-shouldBecomeDifferent('internals.hasSpellingMarker(document, 0, 2)', 'true', finishJSTest); |
+assertions = [ |
+ () => {}, |
+ () => assert_true(internals.hasSpellingMarker(document, 0, 2)), |
+ () => assert_false(internals.hasSpellingMarker(document, 0, 2)) |
+]; |
+runSpellingTest(steps, assertions, 'Blink does not spellcheck text when pasting text and continuous spellcheck is turned off.') |
</script> |
</body> |
</html> |