| 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;
|
|
|