1 description('Tests if the spellchecker behaves correctly when child has own '
2 + 'spellcheck attribute.');
6 if (window
.internals
) {
7 internals
.settings
.setUnifiedTextCheckerEnabled(true);
8 internals
.settings
.setAsynchronousSpellCheckingEnabled(true);
11 var root
= document
.createElement("div");
12 document
.body
.appendChild(root
);
14 function verifyChildSpellingMarker(element
)
16 var testElement
= document
.createElement("div");
17 testElement
.innerHTML
= element
.markup
;
18 root
.appendChild(testElement
);
20 var childText
= testElement
.firstChild
.childNodes
[1].firstChild
;
21 document
.getSelection().collapse(childText
, 1);
22 document
.execCommand("InsertText", false, 'z');
23 document
.execCommand("InsertText", false, 'z');
24 document
.execCommand("InsertText", false, ' ');
26 if (window
.internals
) {
27 debug(escapeHTML(testElement
.innerHTML
));
29 shouldBecomeEqual("internals.hasSpellingMarker(document, 1, 2)", element
.shouldBeMisspelled
? "true" : "false", function() {
38 { markup
: "<div contentEditable>Foo <span spellcheck='false' id='child'>[]</span> Baz</div>", shouldBeMisspelled
: false },
39 { markup
: "<div contentEditable>Foo <span id='child'>[]</span> Baz</div>", shouldBeMisspelled
: true },
40 { markup
: "<div contentEditable>Foo <span spellcheck='true' id='child'>[]</span> Baz</div>", shouldBeMisspelled
: true },
41 { markup
: "<div spellcheck='false' contentEditable>Foo <span spellcheck='false' id='child'>[]</span> Baz</div>", shouldBeMisspelled
: false },
42 { markup
: "<div spellcheck='false' contentEditable>Foo <span id='child'>[]</span> Baz</div>", shouldBeMisspelled
: false },
43 { markup
: "<div spellcheck='false' contentEditable>Foo <span spellcheck='true' id='child'>[]</span> Baz</div>", shouldBeMisspelled
: true },
44 { markup
: "<div spellcheck='true' contentEditable>Foo <span spellcheck='false' id='child'>[]</span> Baz</div>", shouldBeMisspelled
: false },
45 { markup
: "<div spellcheck='true' contentEditable>Foo <span id='child'>[]</span> Baz</div>", shouldBeMisspelled
: true },
46 { markup
: "<div spellcheck='true' contentEditable>Foo <span spellcheck='true' id='child'>[]</span> Baz</div>", shouldBeMisspelled
: true }
51 var nextTestCase
= testCases
.shift();
53 return setTimeout(verifyChildSpellingMarker(nextTestCase
), 0);
59 var successfullyParsed
= true;