1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../resources/js-test.js"></script>
7 <p id=
"description"></p>
8 <div id=
"console"></div>
10 description('For Bug 73511: Internals should have a method to return the max sequence number of spellcheck request.');
12 if (window
.internals
) {
13 window
.jsTestIsAsync
= true;
14 internals
.settings
.setAsynchronousSpellCheckingEnabled(true);
17 var testRoot
= document
.createElement("div");
18 document
.body
.insertBefore(testRoot
, document
.body
.firstChild
);
20 var source
= document
.createElement("div");
21 source
.innerHTML
= "foo bar";
22 testRoot
.appendChild(source
);
24 function createInput(testRoot
) {
25 var e
= document
.createElement('input');
26 e
.setAttribute("type", "text");
27 testRoot
.appendChild(e
);
32 function createTextArea(testRoot
) {
33 var e
= document
.createElement("textarea");
34 testRoot
.appendChild(e
);
39 function createContentEditable(testRoot
) {
40 var e
= document
.createElement("div");
41 e
.setAttribute("contentEditable", "true");
42 testRoot
.appendChild(e
);
48 createInput(testRoot
),
49 createTextArea(testRoot
),
50 createContentEditable(testRoot
),
53 var sel
= window
.getSelection();
56 for (var i
= 0; i
< destinations
.length
; ++i
) {
59 if (!window
.internals
)
61 var sequence
= internals
.lastSpellCheckRequestSequence(document
);
62 var processed
= internals
.lastSpellCheckProcessedSequence(document
);
63 copyAndPaste(source
, destinations
[i
]);
64 verify(sequence
, processed
);
70 function verifyIfAny()
72 var next
= tests
.shift();
78 testRoot
.style
.display
= "none";
82 function copyAndPaste(source
, dest
)
84 sel
.selectAllChildren(source
);
85 document
.execCommand("Copy");
87 if (dest
instanceof HTMLInputElement
|| dest
instanceof HTMLTextAreaElement
) {
92 sel
.selectAllChildren(dest
);
94 document
.execCommand("Paste");
97 function verify(sequence
, processed
)
102 var newSequence
= internals
.lastSpellCheckRequestSequence(document
);
103 var newProcessed
= internals
.lastSpellCheckProcessedSequence(document
);
105 var verified
= newSequence
>= sequence
&& newProcessed
>= processed
&& newSequence
== newProcessed
;
107 testPassed("SpellCheck sequence seems working correctly.");
114 testFailed("SpellCheck sequence didn't increase.");
120 window
.setTimeout(trial
, nsleep
);
127 var successfullyParsed
= true;