OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
| 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> |
4 <script src="resources/util.js"></script> | 6 <script src="resources/util.js"></script> |
5 <script src="../../resources/js-test.js"></script> | |
6 </head> | 7 </head> |
7 <body> | 8 <body> |
8 <pre id="console"></pre> | 9 <pre id="console"></pre> |
9 <iframe id="frame1" src="data:text/html,<body contenteditable></body>"></iframe> | 10 <iframe id="frame1"></iframe> |
10 <iframe id="frame2" src="data:text/html,<body contenteditable></body>"></iframe> | 11 <iframe id="frame2"></iframe> |
11 | 12 |
12 <script> | 13 <script> |
| 14 var frame1 = document.getElementById('frame1'); |
| 15 var testEditable1 = frame1.contentWindow.document.createElement('div'); |
| 16 testEditable1.setAttribute('contentEditable', 'true'); |
| 17 frame1.contentWindow.document.body.appendChild(testEditable1); |
| 18 var frame2 = document.getElementById('frame2'); |
| 19 var testEditable2 = frame2.contentWindow.document.createElement('div'); |
| 20 testEditable2.setAttribute('contentEditable', 'true'); |
| 21 frame2.contentWindow.document.body.appendChild(testEditable2); |
13 | 22 |
14 description("Last word written in an editable in one frame should be " + | 23 var steps = [ |
15 "spellchecked when focusing other frame. To test manually type some " + | 24 function() { |
16 "misspelled word in one frame and focus other frame. The word should be marked."
); | 25 testEditable1.focus(); |
| 26 frame1.contentWindow.document.execCommand('InsertText', false, 'zz'); |
| 27 }, |
| 28 function() { |
| 29 testEditable2.focus(); |
| 30 } |
| 31 ]; |
17 | 32 |
18 if (window.internals) { | 33 var assertions = [ |
19 var frame1 = document.getElementById("frame1"); | 34 () => assert_equals(internals.markerCountForNode(testEditable1.childNodes[0]
, 'spelling'), 0), |
20 var testEditable1 = frame1.contentWindow.document.createElement("div"); | 35 () => assert_equals(internals.markerCountForNode(testEditable1.childNodes[0]
, 'spelling'), 1) |
21 testEditable1.setAttribute("contentEditable", "true"); | 36 ]; |
22 frame1.contentWindow.document.body.appendChild(testEditable1); | 37 |
23 var frame2 = document.getElementById("frame2"); | 38 runSpellingTest(steps, assertions,'Text written in an editable in one frame shou
ld be spellchecked when focusing other frame') |
24 var testEditable2 = frame1.contentWindow.document.createElement("div"); | |
25 testEditable2.setAttribute("contentEditable", "true"); | |
26 frame2.contentWindow.document.body.appendChild(testEditable2); | |
27 testEditable1.focus(); | |
28 frame1.contentWindow.document.execCommand("InsertText", false, "zz"); | |
29 shouldBe('internals.markerCountForNode(testEditable1.childNodes[0], "spellin
g")', '0'); | |
30 testEditable2.focus(); | |
31 shouldBe('internals.markerCountForNode(testEditable1.childNodes[0], "spellin
g")', '1'); | |
32 } else { | |
33 log("Automatic testing impossible. Test manually. See steps in the descripti
on."); | |
34 } | |
35 </script> | 39 </script> |
36 </body> | 40 </body> |
37 </html> | 41 </html> |
OLD | NEW |