Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: third_party/WebKit/LayoutTests/editing/spelling/spellcheck-paste-disabled.html

Issue 2224103003: Convert some spell-checking layout tests to use unified text checker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@SpellCheckerDebugInfo
Patch Set: add setUnifiedTextCheckerEnabled(true) in util.js Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/editing/spelling/spellcheck-paste-disabled.html
diff --git a/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-paste-disabled.html b/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-paste-disabled.html
index f6bddf76b3f396971170e020150a21dd36ed0dd0..6ed31d426cf118b2c2f823c36d9d8e6fbca25384 100644
--- a/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-paste-disabled.html
+++ b/third_party/WebKit/LayoutTests/editing/spelling/spellcheck-paste-disabled.html
@@ -1,40 +1,51 @@
<!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><br/>
-<div id="dst" contenteditable="true" spellcheck="false"></div>
+<div id="src" contenteditable></div><br/>
+<div id="dst" contenteditable spellcheck="false"></div>
</div>
-<script language="javascript">
-description('Test if WebKit does not spellcheck text when pasting text to an element having spellchecking disabled. ' +
- 'To test manually, 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');
-
var dstNode = document.getElementById('dst');
-dstNode.focus();
-document.execCommand('Paste');
-shouldBecomeDifferent('internals.hasSpellingMarker(document, 0, 2)', 'true', finishJSTest);
+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');
+ dstNode.focus();
+ document.execCommand('Paste');
+ }
+];
+
+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 to an element having spellchecking disabled.')
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698