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

Unified Diff: LayoutTests/editing/spelling/script-tests/spelling-attribute-at-child.js

Issue 190663014: Verify spellcheck attribute asynchronously (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: apply tony and groby comments Created 6 years, 9 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
« no previous file with comments | « no previous file | LayoutTests/editing/spelling/script-tests/spelling-attribute-change.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/editing/spelling/script-tests/spelling-attribute-at-child.js
diff --git a/LayoutTests/editing/spelling/script-tests/spelling-attribute-at-child.js b/LayoutTests/editing/spelling/script-tests/spelling-attribute-at-child.js
index 1810c2897f53e956c422caf56936cb3f6f4ba499..7dab8dcbfb7a5cd092375254091d2682e5484ddf 100644
--- a/LayoutTests/editing/spelling/script-tests/spelling-attribute-at-child.js
+++ b/LayoutTests/editing/spelling/script-tests/spelling-attribute-at-child.js
@@ -1,29 +1,59 @@
-description('Tests if the spellchecker behavior change after the spellcheck attribute changed by the script.');
+description('Tests if the spellchecker behaves correctly when child has own '
+ + 'spellcheck attribute.');
+
+jsTestIsAsync = true;
+
+if (window.internals) {
+ internals.settings.setUnifiedTextCheckerEnabled(true);
+ internals.settings.setAsynchronousSpellCheckingEnabled(true);
+}
var root = document.createElement("div");
document.body.appendChild(root);
-function childHasSpellingMarker(markup)
+function verifyChildSpellingMarker(element)
{
- root.innerHTML = markup;
- var text = document.getElementById("child").firstChild;
- document.getSelection().setPosition(text, 1);
+ var testElement = document.createElement("div");
+ testElement.innerHTML = element.markup;
+ root.appendChild(testElement);
+
+ var childText = testElement.firstChild.childNodes[1].firstChild;
+ document.getSelection().setPosition(childText, 1);
document.execCommand("InsertText", false, 'z');
document.execCommand("InsertText", false, 'z');
document.execCommand("InsertText", false, ' ');
- var marked = internals.hasSpellingMarker(document, 1, 2);
- root.innerHTML = "";
- return marked;
+
+ if (window.internals) {
+ debug(escapeHTML(testElement.innerHTML));
+
+ shouldBecomeEqual("internals.hasSpellingMarker(document, 1, 2)", element.shouldBeMisspelled ? "true" : "false", function() {
+ debug("");
+ done();
+ });
+ } else
+ done();
}
-shouldBeFalse("childHasSpellingMarker(\"<div contentEditable>Foo <span spellcheck='false' id='child'>[]</span> Baz</div>\")");
-shouldBeTrue("childHasSpellingMarker(\"<div contentEditable>Foo <span id='child'>[]</span> Baz</div>\")");
-shouldBeTrue("childHasSpellingMarker(\"<div contentEditable>Foo <span spellcheck='true' id='child'>[]</span> Baz</div>\")");
-shouldBeFalse("childHasSpellingMarker(\"<div spellcheck='false' contentEditable>Foo <span spellcheck='false' id='child'>[]</span> Baz</div>\")");
-shouldBeFalse("childHasSpellingMarker(\"<div spellcheck='false' contentEditable>Foo <span id='child'>[]</span> Baz</div>\")");
-shouldBeTrue("childHasSpellingMarker(\"<div spellcheck='false' contentEditable>Foo <span spellcheck='true' id='child'>[]</span> Baz</div>\")");
-shouldBeFalse("childHasSpellingMarker(\"<div spellcheck='true' contentEditable>Foo <span spellcheck='false' id='child'>[]</span> Baz</div>\")");
-shouldBeTrue("childHasSpellingMarker(\"<div spellcheck='true' contentEditable>Foo <span id='child'>[]</span> Baz</div>\")");
-shouldBeTrue("childHasSpellingMarker(\"<div spellcheck='true' contentEditable>Foo <span spellcheck='true' id='child'>[]</span> Baz</div>\")");
+var testCases = [
+ { markup: "<div contentEditable>Foo <span spellcheck='false' id='child'>[]</span> Baz</div>", shouldBeMisspelled: false },
+ { markup: "<div contentEditable>Foo <span id='child'>[]</span> Baz</div>", shouldBeMisspelled: true },
+ { markup: "<div contentEditable>Foo <span spellcheck='true' id='child'>[]</span> Baz</div>", shouldBeMisspelled: true },
+ { markup: "<div spellcheck='false' contentEditable>Foo <span spellcheck='false' id='child'>[]</span> Baz</div>", shouldBeMisspelled: false },
+ { markup: "<div spellcheck='false' contentEditable>Foo <span id='child'>[]</span> Baz</div>", shouldBeMisspelled: false },
+ { markup: "<div spellcheck='false' contentEditable>Foo <span spellcheck='true' id='child'>[]</span> Baz</div>", shouldBeMisspelled: true },
+ { markup: "<div spellcheck='true' contentEditable>Foo <span spellcheck='false' id='child'>[]</span> Baz</div>", shouldBeMisspelled: false },
+ { markup: "<div spellcheck='true' contentEditable>Foo <span id='child'>[]</span> Baz</div>", shouldBeMisspelled: true },
+ { markup: "<div spellcheck='true' contentEditable>Foo <span spellcheck='true' id='child'>[]</span> Baz</div>", shouldBeMisspelled: true }
+];
+
+function done()
+{
+ var nextTestCase = testCases.shift();
+ if (nextTestCase)
+ return setTimeout(verifyChildSpellingMarker(nextTestCase), 0);
+
+ finishJSTest();
+}
+done();
var successfullyParsed = true;
« no previous file with comments | « no previous file | LayoutTests/editing/spelling/script-tests/spelling-attribute-change.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698