OLD | NEW |
---|---|
1 <script src="../editing.js"></script> | 1 <script src="../editing.js"></script> |
2 | 2 |
3 <script> | 3 <script> |
4 function log(message) { | 4 function log(message) { |
5 var console = document.getElementById("console"); | 5 var console = document.getElementById("console"); |
6 var li = document.createElement("li"); | 6 var li = document.createElement("li"); |
7 var text = document.createTextNode(message); | 7 var text = document.createTextNode(message); |
8 li.appendChild(text); | 8 li.appendChild(text); |
9 console.appendChild(li); | 9 console.appendChild(li); |
10 } | 10 } |
11 | 11 |
12 function part1() { | 12 function part1() { |
yosin_UTC9
2016/07/01 09:21:21
Optional: Could you convert this test to use w3c t
Xiaocheng
2016/07/04 06:29:23
Done.
| |
13 frames['iframe'].document.body.focus(); | 13 frames['iframe'].document.body.focus(); |
14 | 14 |
15 // Hack to perform the editing command. Should be able to | 15 // Hack to perform the editing command. Should not be able to |
yosin_UTC9
2016/07/01 09:21:21
How about just say "Call execCommand for subframe
Xiaocheng
2016/07/04 06:29:23
Done (kind of).
| |
16 // call execCommand on the main document. | 16 // call execCommand on the main document. |
17 frames['iframe'].document.execCommand('InsertText', false, 'c'); | 17 frames['iframe'].document.execCommand('InsertText', false, 'c'); |
18 | 18 |
19 if (frames['iframe'].document.body.innerText != 'c') { | 19 if (frames['iframe'].document.body.innerText != 'c') { |
20 log("FAIL: could not insert text."); | 20 log("FAIL: could not insert text."); |
21 if (window.testRunner) | 21 if (window.testRunner) |
22 testRunner.notifyDone(); | 22 testRunner.notifyDone(); |
23 return; | 23 return; |
24 } | 24 } |
25 | 25 |
26 if (!document.queryCommandEnabled('Undo')) { | 26 if (document.queryCommandEnabled('Undo')) { |
27 log("FAIL: Undo is not enabled after text insertion."); | 27 log("FAIL: Undo is enabled in main document after text insertion in subf rame."); |
28 if (window.testRunner) | 28 if (window.testRunner) |
29 testRunner.notifyDone(); | 29 testRunner.notifyDone(); |
30 return; | 30 return; |
31 } | 31 } |
32 | 32 |
33 window.location = window.location.toString() + "?part2"; | 33 window.location = window.location.toString() + "?part2"; |
34 } | 34 } |
35 | 35 |
36 function part2() { | 36 function part2() { |
37 if (frames['iframe'].document.body.innerText != '') | 37 if (frames['iframe'].document.body.innerText != '') |
38 log("FAIL: subframe still has old content after navigaiton."); | 38 log("FAIL: subframe still has old content after navigaiton."); |
39 | 39 |
40 if (!document.queryCommandEnabled('Undo')) | 40 if (!document.queryCommandEnabled('Undo')) |
41 log("Success"); | 41 log("Success"); |
42 else | 42 else |
43 log("Failure, Undo was still enabled after the location changed (but at least we didn't crash!)"); | 43 log("Failure, Undo is enabled after the location changed (but at least w e didn't crash!)"); |
44 | 44 |
45 if (window.testRunner) | 45 if (window.testRunner) |
46 testRunner.notifyDone(); | 46 testRunner.notifyDone(); |
47 } | 47 } |
48 | 48 |
49 function runTest() { | 49 function runTest() { |
50 if (window.location.toString().indexOf("?part2") == -1) { | 50 if (window.location.toString().indexOf("?part2") == -1) { |
51 part1(); | 51 part1(); |
52 } else { | 52 } else { |
53 part2(); | 53 part2(); |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 if (window.testRunner) { | 57 if (window.testRunner) { |
58 testRunner.waitUntilDone(); | 58 testRunner.waitUntilDone(); |
59 testRunner.dumpAsText(); | 59 testRunner.dumpAsText(); |
60 } | 60 } |
61 | 61 |
62 </script> | 62 </script> |
63 | 63 |
64 <body onload="runTest()"> | 64 <body onload="runTest()"> |
65 <iframe name="iframe" src="../resources/contenteditable-iframe-src.html"></ifram e> | 65 <iframe name="iframe" src="../resources/contenteditable-iframe-src.html"></ifram e> |
66 <ul id="console"></ul> | 66 <ul id="console"></ul> |
67 </body> | 67 </body> |
OLD | NEW |