OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../fast/js/resources/js-test-pre.js"></script> | 4 <script src="../../fast/js/resources/js-test-pre.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <div id="container"> | 7 <div id="container"> |
8 <div id="destination" contentEditable></div> | 8 <div id="destination" contentEditable></div> |
9 </div> | 9 </div> |
10 | 10 |
11 <script> | 11 <script> |
12 | 12 |
13 function verify(nretry) | |
14 { | |
15 if (!nretry) { | |
16 finishJSTest() | |
17 return; | |
18 } | |
19 | |
20 var texts = destination.childNodes; | |
21 markedText = null; | |
22 for (var i = 0; i < texts.length; ++i) { | |
23 if (internals.markerCountForNode(texts[i], "spelling")) { | |
24 markedText = internals.markerRangeForNode(texts[i], "spelling", 0).t
oString(); | |
25 markerDescription = internals.markerDescriptionForNode(texts[i], "sp
elling", 0); | |
26 break; | |
27 } | |
28 } | |
29 | |
30 if (markedText != null) { | |
31 shouldBeEqualToString("markedText", "wellcome"); | |
32 shouldBeEqualToString("markerDescription", "welcome"); | |
33 finishJSTest(); | |
34 } | |
35 | |
36 // Wait until the async spellchecking is done. | |
37 window.setTimeout(function() { verify(nretry - 1); }, 0); | |
38 } | |
39 | |
40 function test() | 13 function test() |
41 { | 14 { |
42 jsTestIsAsync = true; | 15 jsTestIsAsync = true; |
43 internals.settings.setUnifiedTextCheckerEnabled(true); | 16 internals.settings.setUnifiedTextCheckerEnabled(true); |
44 internals.settings.setAsynchronousSpellCheckingEnabled(true); | 17 internals.settings.setAsynchronousSpellCheckingEnabled(true); |
45 | 18 |
46 var sel = window.getSelection(); | 19 var sel = window.getSelection(); |
47 var destination = document.getElementById("destination"); | 20 var destination = document.getElementById("destination"); |
48 destination.focus(); | 21 destination.focus(); |
49 document.execCommand("InsertHTML", false, "wellcome"); | 22 document.execCommand("InsertHTML", false, "wellcome"); |
50 document.execCommand("InsertText", false, "."); | 23 document.execCommand("InsertText", false, "."); |
51 | 24 |
52 window.setTimeout(function() { verify(10); }, 0); | 25 shouldBecomeEqualToString('internals.markerDescriptionForNode(destination.fi
rstChild, "spelling", 0)', 'welcome', finishJSTest); |
53 } | 26 } |
54 | 27 |
55 description("The spellchecker should store replacement text in each marker."); | 28 description("The spellchecker should store replacement text in each marker."); |
56 if (window.internals) | 29 if (window.internals) |
57 test(); | 30 test(); |
58 | 31 |
59 </script> | 32 </script> |
60 <script src="../../fast/js/resources/js-test-post.js"></script> | 33 <script src="../../fast/js/resources/js-test-post.js"></script> |
61 </body> | 34 </body> |
62 </html> | 35 </html> |
OLD | NEW |