<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[163432] trunk/LayoutTests</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/163432">163432</a></dd>
<dt>Author</dt> <dd>g.czajkowski@samsung.com</dd>
<dt>Date</dt> <dd>2014-02-05 01:02:43 -0800 (Wed, 05 Feb 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Verify spellcheck attribute asynchronously
https://bugs.webkit.org/show_bug.cgi?id=128174
Reviewed by Sam Weinig.
Refactoring spelling tests that verify spellcheck attribute to use
asynchronous text checking.
* editing/spelling/spelling-attribute-at-child-expected.txt:
* editing/spelling/script-tests/spelling-attribute-at-child.js:
Do not use getElementById if more than one element has the same
id ('child'). Although we defined a bunch of elements with id
'child', however only first one was retrieved and tested.
Additionally, dump current markup so that user is able to see
which element is being tested.
* editing/spelling/spelling-attribute-change-expected.txt:
* editing/spelling/script-tests/spelling-attribute-change.js:
* editing/spelling/spellcheck-attribute-expected.txt:
* editing/spelling/spellcheck-attribute.html:
Dump markup to increase readability of test expectation.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestseditingspellingscripttestsspellingattributeatchildjs">trunk/LayoutTests/editing/spelling/script-tests/spelling-attribute-at-child.js</a></li>
<li><a href="#trunkLayoutTestseditingspellingscripttestsspellingattributechangejs">trunk/LayoutTests/editing/spelling/script-tests/spelling-attribute-change.js</a></li>
<li><a href="#trunkLayoutTestseditingspellingspellcheckattributeexpectedtxt">trunk/LayoutTests/editing/spelling/spellcheck-attribute-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingspellingspellcheckattributehtml">trunk/LayoutTests/editing/spelling/spellcheck-attribute.html</a></li>
<li><a href="#trunkLayoutTestseditingspellingspellingattributeatchildexpectedtxt">trunk/LayoutTests/editing/spelling/spelling-attribute-at-child-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingspellingspellingattributechangeexpectedtxt">trunk/LayoutTests/editing/spelling/spelling-attribute-change-expected.txt</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (163431 => 163432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-02-05 07:11:57 UTC (rev 163431)
+++ trunk/LayoutTests/ChangeLog        2014-02-05 09:02:43 UTC (rev 163432)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2014-02-05 Grzegorz Czajkowski <g.czajkowski@samsung.com>
+
+ Verify spellcheck attribute asynchronously
+ https://bugs.webkit.org/show_bug.cgi?id=128174
+
+ Reviewed by Sam Weinig.
+
+ Refactoring spelling tests that verify spellcheck attribute to use
+ asynchronous text checking.
+
+ * editing/spelling/spelling-attribute-at-child-expected.txt:
+ * editing/spelling/script-tests/spelling-attribute-at-child.js:
+ Do not use getElementById if more than one element has the same
+ id ('child'). Although we defined a bunch of elements with id
+ 'child', however only first one was retrieved and tested.
+ Additionally, dump current markup so that user is able to see
+ which element is being tested.
+
+ * editing/spelling/spelling-attribute-change-expected.txt:
+ * editing/spelling/script-tests/spelling-attribute-change.js:
+
+ * editing/spelling/spellcheck-attribute-expected.txt:
+ * editing/spelling/spellcheck-attribute.html:
+ Dump markup to increase readability of test expectation.
+
</ins><span class="cx"> 2014-02-04 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><span class="cx"> Undelete the "build" directories erroneously removed in r163427.
</span></span></pre></div>
<a id="trunkLayoutTestseditingspellingscripttestsspellingattributeatchildjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/spelling/script-tests/spelling-attribute-at-child.js (163431 => 163432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/spelling/script-tests/spelling-attribute-at-child.js        2014-02-05 07:11:57 UTC (rev 163431)
+++ trunk/LayoutTests/editing/spelling/script-tests/spelling-attribute-at-child.js        2014-02-05 09:02:43 UTC (rev 163432)
</span><span class="lines">@@ -1,29 +1,50 @@
</span><span class="cx"> description('Tests if the spellchecker behavior change after the spellcheck attribute changed by the script.');
</span><span class="cx">
</span><ins>+jsTestIsAsync = true;
+
+if (window.internals) {
+ internals.settings.setUnifiedTextCheckerEnabled(true);
+ internals.settings.setAsynchronousSpellCheckingEnabled(true);
+}
+
</ins><span class="cx"> var root = document.createElement("div");
</span><span class="cx"> document.body.appendChild(root);
</span><span class="cx">
</span><del>-function childHasSpellingMarker(markup)
</del><ins>+function verifyChildSpellingMarker(markup, expectation)
</ins><span class="cx"> {
</span><span class="cx"> root.innerHTML = markup;
</span><del>- var text = document.getElementById("child").firstChild;
- document.getSelection().setPosition(text, 1);
</del><ins>+ var childText = root.firstChild.childNodes[1].firstChild;
+ document.getSelection().setPosition(childText, 1); // [^]
</ins><span class="cx"> document.execCommand("InsertText", false, 'z');
</span><span class="cx"> document.execCommand("InsertText", false, 'z');
</span><span class="cx"> document.execCommand("InsertText", false, ' ');
</span><del>- var marked = internals.hasSpellingMarker(1, 2);
- root.innerHTML = "";
- return marked;
</del><ins>+ debug(escapeHTML(root.innerHTML));
+ shouldBecomeEqual('internals.hasSpellingMarker(1, 2)', expectation ? "true" : "false", function() {
+ root.innerHTML = "";
+ debug("");
+ done();
+ });
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-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>\")");
</del><ins>+var tests = [ function() { verifyChildSpellingMarker("<div contentEditable>Foo <span spellcheck='false' id='child'>[]</span> Baz</div>", false); },
+ function() { verifyChildSpellingMarker("<div contentEditable>Foo <span id='child'>[]</span> Baz</div>", true); },
+ function() { verifyChildSpellingMarker("<div contentEditable>Foo <span spellcheck='true' id='child'>[]</span> Baz</div>", true); },
+ function() { verifyChildSpellingMarker("<div spellcheck='false' contentEditable>Foo <span spellcheck='false' id='child'>[]</span> Baz</div>", false); },
+ function() { verifyChildSpellingMarker("<div spellcheck='false' contentEditable>Foo <span id='child'>[]</span> Baz</div>", false); },
+ function() { verifyChildSpellingMarker("<div spellcheck='false' contentEditable>Foo <span spellcheck='true' id='child'>[]</span> Baz</div>", true); },
+ function() { verifyChildSpellingMarker("<div spellcheck='true' contentEditable>Foo <span spellcheck='false' id='child'>[]</span> Baz</div>", false); },
+ function() { verifyChildSpellingMarker("<div spellcheck='true' contentEditable>Foo <span id='child'>[]</span> Baz</div>", true); },
+ function() { verifyChildSpellingMarker("<div spellcheck='true' contentEditable>Foo <span spellcheck='true' id='child'>[]</span> Baz</div>", true); }
+];
</ins><span class="cx">
</span><ins>+function done()
+{
+ var next = tests.shift();
+ if (next)
+ return window.setTimeout(next, 0);
+
+ finishJSTest();
+}
+done();
+
</ins><span class="cx"> var successfullyParsed = true;
</span></span></pre></div>
<a id="trunkLayoutTestseditingspellingscripttestsspellingattributechangejs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/spelling/script-tests/spelling-attribute-change.js (163431 => 163432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/spelling/script-tests/spelling-attribute-change.js        2014-02-05 07:11:57 UTC (rev 163431)
+++ trunk/LayoutTests/editing/spelling/script-tests/spelling-attribute-change.js        2014-02-05 09:02:43 UTC (rev 163432)
</span><span class="lines">@@ -1,5 +1,12 @@
</span><span class="cx"> description('Tests if the spellchecker behavior change after the spellcheck attribute changed by the script.');
</span><span class="cx">
</span><ins>+jsTestIsAsync = true;
+
+if (window.internals) {
+ internals.settings.setUnifiedTextCheckerEnabled(true);
+ internals.settings.setAsynchronousSpellCheckingEnabled(true);
+}
+
</ins><span class="cx"> var parent = document.createElement("div");
</span><span class="cx"> document.body.appendChild(parent);
</span><span class="cx"> var sel = document.getSelection();
</span><span class="lines">@@ -22,7 +29,7 @@
</span><span class="cx">
</span><span class="cx"> window.target = target;
</span><span class="cx"> shouldBe("target.spellcheck", enabled ? "true" : "false");
</span><del>- shouldBe("internals.hasSpellingMarker(6, 2)", enabled ? "true" : "false");
</del><ins>+ shouldBecomeEqual("internals.hasSpellingMarker(6, 2)", enabled ? "true" : "false", done);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function createElement(tagName, spellcheck)
</span><span class="lines">@@ -41,46 +48,41 @@
</span><span class="cx"> parent.appendChild(target);
</span><span class="cx">
</span><span class="cx"> testSpellCheckingEnabled(target, expectation);
</span><del>- parent.innerHTML = "";
</del><span class="cx"> }
</span><span class="cx">
</span><del>-// default -> true
-testFor("SPAN", undefined, true);
-// default -> false
-testFor("SPAN", undefined, false);
-// true -> true
-testFor("SPAN", true, true);
-// true -> false
-testFor("SPAN", true, false);
-// false -> true
-testFor("SPAN", false, true);
-// false -> false
-testFor("SPAN", false, false);
</del><ins>+var tests = [ function() { testFor("SPAN", undefined, true); }, // default -> true
+ function() { testFor("SPAN", undefined, false); }, // default -> false
+ function() { testFor("SPAN", true, true); }, // true -> true
+ function() { testFor("SPAN", true, false); }, // true -> false
+ function() { testFor("SPAN", false, true); }, // false -> true
+ function() { testFor("SPAN", false, false); }, // false -> false
</ins><span class="cx">
</span><del>-// default -> true
-testFor("INPUT", undefined, true);
-// default -> false
-testFor("INPUT", undefined, false);
-// true -> true
-testFor("INPUT", true, true);
-// true -> false
-testFor("INPUT", true, false);
-// false -> true
-testFor("INPUT", false, true);
-// false -> false
-testFor("INPUT", false, false);
</del><ins>+ function() { testFor("INPUT", undefined, true); }, // default -> true
+ function() { testFor("INPUT", undefined, false); }, // default -> false
+ function() { testFor("INPUT", true, true); }, // true -> true
+ function() { testFor("INPUT", true, false); }, // true -> false
+ function() { testFor("INPUT", false, true); }, // false -> true
+ function() { testFor("INPUT", false, false); }, // false -> false
</ins><span class="cx">
</span><del>-// default -> true
-testFor("TEXTAREA", undefined, true);
-// default -> false
-testFor("TEXTAREA", undefined, false);
-// true -> true
-testFor("TEXTAREA", true, true);
-// true -> false
-testFor("TEXTAREA", true, false);
-// false -> true
-testFor("TEXTAREA", false, true);
-// false -> false
-testFor("TEXTAREA", false, false);
</del><ins>+ function() { testFor("TEXTAREA", undefined, true); }, // default -> true
+ function() { testFor("TEXTAREA", undefined, false); }, // default -> false
+ function() { testFor("TEXTAREA", true, true); }, // true -> true
+ function() { testFor("TEXTAREA", true, false); }, // true -> false
+ function() { testFor("TEXTAREA", false, true); }, // false -> true
+ function() { testFor("TEXTAREA", false, false); }, // false -> false
+ ];
</ins><span class="cx">
</span><ins>+function done()
+{
+ if (window.internals) {
+ var next = tests.shift();
+ if (next)
+ return window.setTimeout(next, 0);
+
+ parent.innerHTML = "";
+ }
+ finishJSTest();
+}
+done();
+
</ins><span class="cx"> var successfullyParsed = true;
</span></span></pre></div>
<a id="trunkLayoutTestseditingspellingspellcheckattributeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/spelling/spellcheck-attribute-expected.txt (163431 => 163432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/spelling/spellcheck-attribute-expected.txt        2014-02-05 07:11:57 UTC (rev 163431)
+++ trunk/LayoutTests/editing/spelling/spellcheck-attribute-expected.txt        2014-02-05 09:02:43 UTC (rev 163432)
</span><span class="lines">@@ -1,56 +1,60 @@
</span><del>-This tests if the "spellcheck" attribute is implemented as written in its specification. If this test succeeds, you can see forms filled with an invalid word 'zz '. Nevertheless, the 'zz ' is not marked as misspelled in all of them.
</del><ins>+This tests if the "spellcheck" attribute is implemented as written in its specification. If this test succeeds, you can see forms filled with an invalid word "zz". Nevertheless, the "zz" is not marked as misspelled in all of them.
</ins><span class="cx">
</span><del>-id=test1_1 type=text spellcheck=true parent's spellcheck=true
-PASS internals.hasSpellingMarker(0, 2) is true
-id=test1_2 type=text spellcheck=true parent's spellcheck=true
-PASS internals.hasSpellingMarker(0, 2) is true
-id=test1_3 type=text spellcheck=false parent's spellcheck=true
-PASS internals.hasSpellingMarker(0, 2) is false
-id=test1_4 type=text spellcheck=true parent's spellcheck=true
-PASS internals.hasSpellingMarker(0, 2) is true
-id=test1_5 type=text spellcheck=true parent's spellcheck=true
-PASS internals.hasSpellingMarker(0, 2) is true
-id=test1_6 type=text spellcheck=true parent's spellcheck=true
-PASS internals.hasSpellingMarker(0, 2) is true
</del><ins>+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
</ins><span class="cx">
</span><del>-id=test2_1 type=text spellcheck=false parent's spellcheck=false
-PASS internals.hasSpellingMarker(0, 2) is false
-id=test2_2 type=text spellcheck=true parent's spellcheck=false
-PASS internals.hasSpellingMarker(0, 2) is true
-id=test2_3 type=text spellcheck=false parent's spellcheck=false
-PASS internals.hasSpellingMarker(0, 2) is false
-id=test2_4 type=text spellcheck=false parent's spellcheck=false
-PASS internals.hasSpellingMarker(0, 2) is false
-id=test2_5 type=text spellcheck=true parent's spellcheck=false
-PASS internals.hasSpellingMarker(0, 2) is true
-id=test2_6 type=text spellcheck=false parent's spellcheck=false
-PASS internals.hasSpellingMarker(0, 2) is false
</del><span class="cx">
</span><del>-id=test3_1 type=search spellcheck=true parent's spellcheck=true
-PASS internals.hasSpellingMarker(0, 2) is true
-id=test3_2 type=search spellcheck=true parent's spellcheck=true
-PASS internals.hasSpellingMarker(0, 2) is true
-id=test3_3 type=search spellcheck=false parent's spellcheck=true
-PASS internals.hasSpellingMarker(0, 2) is false
-id=test3_4 type=search spellcheck=true parent's spellcheck=true
-PASS internals.hasSpellingMarker(0, 2) is true
-id=test3_5 type=search spellcheck=true parent's spellcheck=true
-PASS internals.hasSpellingMarker(0, 2) is true
-id=test3_6 type=search spellcheck=true parent's spellcheck=true
-PASS internals.hasSpellingMarker(0, 2) is true
</del><ins>+<DIV id=div1 spellcheck=true>
+<INPUT id=test1_1 type=text>zz </INPUT>
+PASS internals.hasSpellingMarker(0, 2) became true
+<INPUT id=test1_2 type=text spellcheck=true>zz </INPUT>
+PASS internals.hasSpellingMarker(0, 2) became true
+<INPUT id=test1_3 type=text spellcheck=false>zz </INPUT>
+PASS internals.hasSpellingMarker(0, 2) became false
+<INPUT id=test1_4 type=text spellcheck=InvalidValue>zz </INPUT>
+PASS internals.hasSpellingMarker(0, 2) became true
+<INPUT id=test1_5 type=text spellcheck>zz </INPUT>
+PASS internals.hasSpellingMarker(0, 2) became true
+</DIV>
</ins><span class="cx">
</span><del>-id=test4_1 type=search spellcheck=false parent's spellcheck=false
-PASS internals.hasSpellingMarker(0, 2) is false
-id=test4_2 type=search spellcheck=true parent's spellcheck=false
-PASS internals.hasSpellingMarker(0, 2) is true
-id=test4_3 type=search spellcheck=false parent's spellcheck=false
-PASS internals.hasSpellingMarker(0, 2) is false
-id=test4_4 type=search spellcheck=false parent's spellcheck=false
-PASS internals.hasSpellingMarker(0, 2) is false
-id=test4_5 type=search spellcheck=true parent's spellcheck=false
-PASS internals.hasSpellingMarker(0, 2) is true
-id=test4_6 type=search spellcheck=false parent's spellcheck=false
-PASS internals.hasSpellingMarker(0, 2) is false
</del><ins>+<DIV id=div2 spellcheck=false>
+<INPUT id=test2_1 type=text>zz </INPUT>
+PASS internals.hasSpellingMarker(0, 2) became false
+<INPUT id=test2_2 type=text spellcheck=true>zz </INPUT>
+PASS internals.hasSpellingMarker(0, 2) became true
+<INPUT id=test2_3 type=text spellcheck=false>zz </INPUT>
+PASS internals.hasSpellingMarker(0, 2) became false
+<INPUT id=test2_4 type=text spellcheck=InvalidValue>zz </INPUT>
+PASS internals.hasSpellingMarker(0, 2) became false
+<INPUT id=test2_5 type=text spellcheck>zz </INPUT>
+PASS internals.hasSpellingMarker(0, 2) became true
+</DIV>
+
+<DIV id=div3 spellcheck=true>
+<INPUT id=test3_1 type=search>zz </INPUT>
+PASS internals.hasSpellingMarker(0, 2) became true
+<INPUT id=test3_2 type=search spellcheck=true>zz </INPUT>
+PASS internals.hasSpellingMarker(0, 2) became true
+<INPUT id=test3_3 type=search spellcheck=false>zz </INPUT>
+PASS internals.hasSpellingMarker(0, 2) became false
+<INPUT id=test3_4 type=search spellcheck=InvalidValue>zz </INPUT>
+PASS internals.hasSpellingMarker(0, 2) became true
+<INPUT id=test3_5 type=search spellcheck>zz </INPUT>
+PASS internals.hasSpellingMarker(0, 2) became true
+</DIV>
+
+<DIV id=div4 spellcheck=false>
+<INPUT id=test4_1 type=search>zz </INPUT>
+PASS internals.hasSpellingMarker(0, 2) became false
+<INPUT id=test4_2 type=search spellcheck=true>zz </INPUT>
+PASS internals.hasSpellingMarker(0, 2) became true
+<INPUT id=test4_3 type=search spellcheck=false>zz </INPUT>
+PASS internals.hasSpellingMarker(0, 2) became false
+<INPUT id=test4_4 type=search spellcheck=InvalidValue>zz </INPUT>
+PASS internals.hasSpellingMarker(0, 2) became false
+<INPUT id=test4_5 type=search spellcheck>zz </INPUT>
+PASS internals.hasSpellingMarker(0, 2) became true
+</DIV>
+
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestseditingspellingspellcheckattributehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/spelling/spellcheck-attribute.html (163431 => 163432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/spelling/spellcheck-attribute.html        2014-02-05 07:11:57 UTC (rev 163431)
+++ trunk/LayoutTests/editing/spelling/spellcheck-attribute.html        2014-02-05 09:02:43 UTC (rev 163432)
</span><span class="lines">@@ -2,101 +2,151 @@
</span><span class="cx"> <head>
</span><span class="cx"> <title>Spellcheck Attribute Test</title>
</span><span class="cx"> <link rel="help" href="http://damowmow.com/playground/spellcheck.txt">
</span><ins>+<script src="../editing.js"></script>
+<script src="resources/util.js"></script>
</ins><span class="cx"> <script src="../../resources/js-test-pre.js"></script>
</span><span class="cx"> </head>
</span><span class="cx"> <body>
</span><del>-<p>This tests if the "spellcheck" attribute is implemented as written in its specification. If this test succeeds, you can see forms filled with an invalid word 'zz '. Nevertheless, the 'zz ' is not marked as misspelled in all of them.
</del><span class="cx"> <div id="testRoot">
</span><del>-
-<div spellcheck="true">
-<label>1.1.</label><input id="test1_1" type="text"></input><br/>
-<label>1.2.</label><input id="test1_2" type="text" spellcheck="true"></input><br/>
-<label>1.3.</label><input id="test1_3" type="text" spellcheck="false"></input><br/>
-<label>1.4.</label><input id="test1_4" type="text" spellcheck="InvalidValue"></input><br/>
-<label>1.5.</label><input id="test1_5" type="text" spellcheck></input><br/>
-<label>1.6.</label><input id="test1_6" type="text"></input><br/>
</del><ins>+<div id="div1" spellcheck="true"></div>
+<div id="div2" spellcheck="false"></div>
+<div id="div3" spellcheck="true"></div>
+<div id="div4" spellcheck="false"></div>
</ins><span class="cx"> </div>
</span><del>-<div spellcheck="false">
-<label>2.1.</label><input id="test2_1" type="text"></input><br/>
-<label>2.2.</label><input id="test2_2" type="text" spellcheck="true"></input><br/>
-<label>2.3.</label><input id="test2_3" type="text" spellcheck="false"></input><br/>
-<label>2.4.</label><input id="test2_4" type="text" spellcheck="InvalidValue"></input><br/>
-<label>2.5.</label><input id="test2_5" type="text" spellcheck></input><br/>
-<label>2.6.</label><input id="test2_6" type="text"></input><br/>
-</div>
</del><ins>+<script>
+description('This tests if the "spellcheck" attribute is implemented '
+ + 'as written in its specification. If this test succeeds, you can see '
+ + 'forms filled with an invalid word "zz". Nevertheless, the "zz" is not '
+ + 'marked as misspelled in all of them.');
</ins><span class="cx">
</span><del>-<div spellcheck="true">
-<label>3.1.</label><input id="test3_1" type="search"></input><br/>
-<label>3.2.</label><input id="test3_2" type="search" spellcheck="true"></input><br/>
-<label>3.3.</label><input id="test3_3" type="search" spellcheck="false"></input><br/>
-<label>3.4.</label><input id="test3_4" type="search" spellcheck="InvalidValue"></input><br/>
-<label>3.5.</label><input id="test3_5" type="search" spellcheck></input><br/>
-<label>3.6.</label><input id="test3_6" type="search"></input><br/>
-</div>
-<div spellcheck="false">
-<label>4.1.</label><input id="test4_1" type="search"></input><br/>
-<label>4.2.</label><input id="test4_2" type="search" spellcheck="true"></input><br/>
-<label>4.3.</label><input id="test4_3" type="search" spellcheck="false"></input><br/>
-<label>4.4.</label><input id="test4_4" type="search" spellcheck="InvalidValue"></input><br/>
-<label>4.5.</label><input id="test4_5" type="search" spellcheck></input><br/>
-<label>4.6.</label><input id="test4_6" type="search"></input><br/>
-</div>
</del><ins>+jsTestIsAsync = true;
</ins><span class="cx">
</span><del>-</div>
-<pre id="console"></pre>
-<script>
-function log(msg) {
- document.getElementById("console").innerHTML += (msg + "\n");
</del><ins>+if (window.internals) {
+ internals.settings.setUnifiedTextCheckerEnabled(true);
+ internals.settings.setAsynchronousSpellCheckingEnabled(true);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-function testMarkerForMisspelledWord(id, shouldBeMarked) {
- var inputElement = document.getElementById(id);
- inputElement.focus();
- document.execCommand("InsertText", false, 'z');
- document.execCommand("InsertText", false, 'z');
- document.execCommand("InsertText", false, ' ');
</del><ins>+function addInputElement(parentId, id, type, spellcheck)
+{
+ var input = document.createElement('input');
+ input.setAttribute('type', type);
+ input.setAttribute('id', id);
+ input.setAttribute('value', 'zz ');
+ if (spellcheck !== undefined)
+ input.setAttribute('spellcheck', spellcheck);
</ins><span class="cx">
</span><del>- log("id=" + id + " type=" + inputElement.type + " spellcheck=" + inputElement.spellcheck
- + " parent's spellcheck=" + inputElement.parentNode.spellcheck);
</del><ins>+ var div = document.getElementById(parentId);
+ div.appendChild(document.createTextNode(id));
+ div.appendChild(input);
+ div.appendChild(document.createElement('br'));
</ins><span class="cx">
</span><del>- shouldBe("internals.hasSpellingMarker(0, 2)", shouldBeMarked ? "true" : "false")
</del><ins>+ return input;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-// For type="text".
-testMarkerForMisspelledWord('test1_1', true);
-testMarkerForMisspelledWord('test1_2', true);
-testMarkerForMisspelledWord('test1_3', false);
-testMarkerForMisspelledWord('test1_4', true);
-testMarkerForMisspelledWord('test1_5', true);
-testMarkerForMisspelledWord('test1_6', true);
-log("");
-testMarkerForMisspelledWord('test2_1', false);
-testMarkerForMisspelledWord('test2_2', true);
-testMarkerForMisspelledWord('test2_3', false);
-testMarkerForMisspelledWord('test2_4', false);
-testMarkerForMisspelledWord('test2_5', true);
-testMarkerForMisspelledWord('test2_6', false);
-log("");
</del><ins>+function testMarkerForMisspelledWord(parentId, shouldBeMisspelled, id, type, spellcheck)
+{
+ var input = addInputElement(parentId, id, type, spellcheck);
+ input.focus();
+ // Activate spellchecking.
+ moveSelectionForwardByWordCommand();
</ins><span class="cx">
</span><del>-// For type="search".
-testMarkerForMisspelledWord('test3_1', true);
-testMarkerForMisspelledWord('test3_2', true);
-testMarkerForMisspelledWord('test3_3', false);
-testMarkerForMisspelledWord('test3_4', true);
-testMarkerForMisspelledWord('test3_5', true);
-testMarkerForMisspelledWord('test3_6', true);
-log("");
-testMarkerForMisspelledWord('test4_1', false);
-testMarkerForMisspelledWord('test4_2', true);
-testMarkerForMisspelledWord('test4_3', false);
-testMarkerForMisspelledWord('test4_4', false);
-testMarkerForMisspelledWord('test4_5', true);
-testMarkerForMisspelledWord('test4_6', false);
</del><ins>+ logMarkup(id, spellcheck, true);
</ins><span class="cx">
</span><del>-if (window.testRunner) {
- // Cleaning up for expeation text if running on DRT.
- document.getElementById("testRoot").style.display = "none";
</del><ins>+ if (window.internals)
+ shouldBecomeEqual('internals.hasSpellingMarker(0, 2)', shouldBeMisspelled ? 'true' : 'false', done);
+ else
+ done();
</ins><span class="cx"> }
</span><ins>+
+function logMarkup(id, spellcheckValue, shouldCloseTag)
+{
+ var element = document.getElementById(id);
+ var elementMarkup = '&lt;' + element.tagName;
+ elementMarkup += ' id=' + element.id;
+
+ if (element.type)
+ elementMarkup += ' type=' + element.type;
+
+ var spellcheckAttrString = '';
+ if (spellcheckValue !== undefined) {
+ if (spellcheckValue != '')
+ spellcheckAttrString = ' spellcheck=' + spellcheckValue;
+ else
+ spellcheckAttrString = ' spellcheck';
+ }
+ elementMarkup += spellcheckAttrString;
+ elementMarkup += '>';
+
+ if (element.value)
+ elementMarkup += element.value;
+
+ if (shouldCloseTag)
+ elementMarkup += '&lt;/' + element.tagName + '>';
+
+ debug(elementMarkup);
+}
+
+function encloseTag(id)
+{
+ var element = document.getElementById(id);
+ logMarkup(id, element.spellcheck ? "true" : "false", false);
+ done();
+}
+
+function closeTag(id)
+{
+ var element = document.getElementById(id);
+ debug('&lt;/' + element.tagName + '>' + '\n');
+ done();
+}
+
+var tests = [
+ function() { encloseTag('div1'); },
+ function() { testMarkerForMisspelledWord('div1', true, 'test1_1', 'text' /*, undefined */); },
+ function() { testMarkerForMisspelledWord('div1', true, 'test1_2', 'text', 'true'); },
+ function() { testMarkerForMisspelledWord('div1', false, 'test1_3', 'text', 'false'); },
+ function() { testMarkerForMisspelledWord('div1', true, 'test1_4', 'text', 'InvalidValue'); },
+ function() { testMarkerForMisspelledWord('div1', true, 'test1_5', 'text', ''); },
+ function() { closeTag('div1'); },
+
+ function() { encloseTag('div2'); },
+ function() { testMarkerForMisspelledWord('div2', false, 'test2_1', 'text' /*, undefined */); },
+ function() { testMarkerForMisspelledWord('div2', true, 'test2_2', 'text', 'true'); },
+ function() { testMarkerForMisspelledWord('div2', false, 'test2_3', 'text', 'false'); },
+ function() { testMarkerForMisspelledWord('div2', false, 'test2_4', 'text', 'InvalidValue'); },
+ function() { testMarkerForMisspelledWord('div2', true, 'test2_5', 'text', ''); },
+ function() { closeTag('div2'); },
+
+ function() { encloseTag('div3'); },
+ function() { testMarkerForMisspelledWord('div3', true, 'test3_1', 'search' /*, undefined */); },
+ function() { testMarkerForMisspelledWord('div3', true, 'test3_2', 'search', 'true'); },
+ function() { testMarkerForMisspelledWord('div3', false, 'test3_3', 'search', 'false'); },
+ function() { testMarkerForMisspelledWord('div3', true, 'test3_4', 'search', 'InvalidValue'); },
+ function() { testMarkerForMisspelledWord('div3', true, 'test3_5', 'search', ''); },
+ function() { closeTag('div3'); },
+
+ function() { encloseTag('div4'); },
+ function() { testMarkerForMisspelledWord('div4', false, 'test4_1', 'search' /*, undefined */); },
+ function() { testMarkerForMisspelledWord('div4', true, 'test4_2', 'search', 'true'); },
+ function() { testMarkerForMisspelledWord('div4', false, 'test4_3', 'search', 'false'); },
+ function() { testMarkerForMisspelledWord('div4', false, 'test4_4', 'search', 'InvalidValue'); },
+ function() { testMarkerForMisspelledWord('div4', true, 'test4_5', 'search', ''); },
+ function() { closeTag('div4'); }
+];
+
+function done()
+{
+ var next = tests.shift();
+ if (next)
+ return window.setTimeout(next, 0);
+
+ if (window.testRunner) {
+ // Cleaning up for expectation text if running on DRT.
+ document.getElementById("testRoot").style.display = "none";
+ }
+ finishJSTest();
+}
+done();
</ins><span class="cx"> </script>
</span><span class="cx"> <script src="../../resources/js-test-post.js"></script>
</span><span class="cx"> </body>
</span></span></pre></div>
<a id="trunkLayoutTestseditingspellingspellingattributeatchildexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/spelling/spelling-attribute-at-child-expected.txt (163431 => 163432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/spelling/spelling-attribute-at-child-expected.txt        2014-02-05 07:11:57 UTC (rev 163431)
+++ trunk/LayoutTests/editing/spelling/spelling-attribute-at-child-expected.txt        2014-02-05 09:02:43 UTC (rev 163432)
</span><span class="lines">@@ -3,15 +3,33 @@
</span><span class="cx"> On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
</span><span class="cx">
</span><span class="cx">
</span><del>-PASS childHasSpellingMarker("<div contentEditable>Foo <span spellcheck='false' id='child'>[]</span> Baz</div>") is false
-PASS childHasSpellingMarker("<div contentEditable>Foo <span id='child'>[]</span> Baz</div>") is true
-PASS childHasSpellingMarker("<div contentEditable>Foo <span spellcheck='true' id='child'>[]</span> Baz</div>") is true
-PASS childHasSpellingMarker("<div spellcheck='false' contentEditable>Foo <span spellcheck='false' id='child'>[]</span> Baz</div>") is false
-PASS childHasSpellingMarker("<div spellcheck='false' contentEditable>Foo <span id='child'>[]</span> Baz</div>") is false
-PASS childHasSpellingMarker("<div spellcheck='false' contentEditable>Foo <span spellcheck='true' id='child'>[]</span> Baz</div>") is true
-PASS childHasSpellingMarker("<div spellcheck='true' contentEditable>Foo <span spellcheck='false' id='child'>[]</span> Baz</div>") is false
-PASS childHasSpellingMarker("<div spellcheck='true' contentEditable>Foo <span id='child'>[]</span> Baz</div>") is true
-PASS childHasSpellingMarker("<div spellcheck='true' contentEditable>Foo <span spellcheck='true' id='child'>[]</span> Baz</div>") is true
</del><ins>+<div contenteditable="">Foo <span spellcheck="false" id="child">[zz ]</span> Baz</div>
+PASS internals.hasSpellingMarker(1, 2) became false
+
+<div contenteditable="">Foo <span id="child">[zz ]</span> Baz</div>
+PASS internals.hasSpellingMarker(1, 2) became true
+
+<div contenteditable="">Foo <span spellcheck="true" id="child">[zz ]</span> Baz</div>
+PASS internals.hasSpellingMarker(1, 2) became true
+
+<div spellcheck="false" contenteditable="">Foo <span spellcheck="false" id="child">[zz ]</span> Baz</div>
+PASS internals.hasSpellingMarker(1, 2) became false
+
+<div spellcheck="false" contenteditable="">Foo <span id="child">[zz ]</span> Baz</div>
+PASS internals.hasSpellingMarker(1, 2) became false
+
+<div spellcheck="false" contenteditable="">Foo <span spellcheck="true" id="child">[zz ]</span> Baz</div>
+PASS internals.hasSpellingMarker(1, 2) became true
+
+<div spellcheck="true" contenteditable="">Foo <span spellcheck="false" id="child">[zz ]</span> Baz</div>
+PASS internals.hasSpellingMarker(1, 2) became false
+
+<div spellcheck="true" contenteditable="">Foo <span id="child">[zz ]</span> Baz</div>
+PASS internals.hasSpellingMarker(1, 2) became true
+
+<div spellcheck="true" contenteditable="">Foo <span spellcheck="true" id="child">[zz ]</span> Baz</div>
+PASS internals.hasSpellingMarker(1, 2) became true
+
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestseditingspellingspellingattributechangeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/spelling/spelling-attribute-change-expected.txt (163431 => 163432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/spelling/spelling-attribute-change-expected.txt        2014-02-05 07:11:57 UTC (rev 163431)
+++ trunk/LayoutTests/editing/spelling/spelling-attribute-change-expected.txt        2014-02-05 09:02:43 UTC (rev 163432)
</span><span class="lines">@@ -4,41 +4,41 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> PASS target.spellcheck is true
</span><del>-PASS internals.hasSpellingMarker(6, 2) is true
</del><ins>+PASS internals.hasSpellingMarker(6, 2) became true
</ins><span class="cx"> PASS target.spellcheck is false
</span><del>-PASS internals.hasSpellingMarker(6, 2) is false
</del><ins>+PASS internals.hasSpellingMarker(6, 2) became false
</ins><span class="cx"> PASS target.spellcheck is true
</span><del>-PASS internals.hasSpellingMarker(6, 2) is true
</del><ins>+PASS internals.hasSpellingMarker(6, 2) became true
</ins><span class="cx"> PASS target.spellcheck is false
</span><del>-PASS internals.hasSpellingMarker(6, 2) is false
</del><ins>+PASS internals.hasSpellingMarker(6, 2) became false
</ins><span class="cx"> PASS target.spellcheck is true
</span><del>-PASS internals.hasSpellingMarker(6, 2) is true
</del><ins>+PASS internals.hasSpellingMarker(6, 2) became true
</ins><span class="cx"> PASS target.spellcheck is false
</span><del>-PASS internals.hasSpellingMarker(6, 2) is false
</del><ins>+PASS internals.hasSpellingMarker(6, 2) became false
</ins><span class="cx"> PASS target.spellcheck is true
</span><del>-PASS internals.hasSpellingMarker(6, 2) is true
</del><ins>+PASS internals.hasSpellingMarker(6, 2) became true
</ins><span class="cx"> PASS target.spellcheck is false
</span><del>-PASS internals.hasSpellingMarker(6, 2) is false
</del><ins>+PASS internals.hasSpellingMarker(6, 2) became false
</ins><span class="cx"> PASS target.spellcheck is true
</span><del>-PASS internals.hasSpellingMarker(6, 2) is true
</del><ins>+PASS internals.hasSpellingMarker(6, 2) became true
</ins><span class="cx"> PASS target.spellcheck is false
</span><del>-PASS internals.hasSpellingMarker(6, 2) is false
</del><ins>+PASS internals.hasSpellingMarker(6, 2) became false
</ins><span class="cx"> PASS target.spellcheck is true
</span><del>-PASS internals.hasSpellingMarker(6, 2) is true
</del><ins>+PASS internals.hasSpellingMarker(6, 2) became true
</ins><span class="cx"> PASS target.spellcheck is false
</span><del>-PASS internals.hasSpellingMarker(6, 2) is false
</del><ins>+PASS internals.hasSpellingMarker(6, 2) became false
</ins><span class="cx"> PASS target.spellcheck is true
</span><del>-PASS internals.hasSpellingMarker(6, 2) is true
</del><ins>+PASS internals.hasSpellingMarker(6, 2) became true
</ins><span class="cx"> PASS target.spellcheck is false
</span><del>-PASS internals.hasSpellingMarker(6, 2) is false
</del><ins>+PASS internals.hasSpellingMarker(6, 2) became false
</ins><span class="cx"> PASS target.spellcheck is true
</span><del>-PASS internals.hasSpellingMarker(6, 2) is true
</del><ins>+PASS internals.hasSpellingMarker(6, 2) became true
</ins><span class="cx"> PASS target.spellcheck is false
</span><del>-PASS internals.hasSpellingMarker(6, 2) is false
</del><ins>+PASS internals.hasSpellingMarker(6, 2) became false
</ins><span class="cx"> PASS target.spellcheck is true
</span><del>-PASS internals.hasSpellingMarker(6, 2) is true
</del><ins>+PASS internals.hasSpellingMarker(6, 2) became true
</ins><span class="cx"> PASS target.spellcheck is false
</span><del>-PASS internals.hasSpellingMarker(6, 2) is false
</del><ins>+PASS internals.hasSpellingMarker(6, 2) became false
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span></span></pre>
</div>
</div>
</body>
</html>