OLD | NEW |
| 1 <!DOCTYPE html> |
| 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> |
1 <script> | 4 <script> |
2 if (window.testRunner) | 5 var tester = async_test('iframe'); |
3 testRunner.dumpEditingCallbacks(); | 6 function runTest() { |
| 7 if (window.internals) |
| 8 internals.settings.setEditingBehavior('win'); |
| 9 var frame = frames[0]; |
| 10 var selection = frame.getSelection(); |
| 11 var doc = frame.document; |
4 | 12 |
5 function foo() { | 13 selection.collapse(doc.body, 0); |
6 var frame = frames[0]; | 14 doc.execCommand('InsertText', false, 'foo bar baz'); |
7 var sel = frame.getSelection(); | 15 selection.modify('extend', 'backward', 'word'); |
8 var doc = frame.document; | 16 doc.execCommand('Cut'); |
9 | 17 doc.execCommand('Paste'); |
10 sel.collapse(doc.body, 0); | 18 |
11 doc.execCommand("InsertText", false, "foo bar baz"); | 19 tester.step(function() { assert_equals(doc.body.innerHTML.replace(/ /,
' ', 'g'), 'foo bar baz'); }); |
12 sel.modify("extend", "backward", "word"); | 20 tester.done(); |
13 doc.execCommand("Cut"); | |
14 doc.execCommand("Paste"); | |
15 if (window.testRunner) | |
16 window.testRunner.notifyDone(); | |
17 } | 21 } |
18 if (window.testRunner) | |
19 window.testRunner.waitUntilDone(); | |
20 </script> | 22 </script> |
21 | |
22 <p>This tests cut/paste inside an editable iframe. You should see 'foo bar baz'
below.</p> | 23 <p>This tests cut/paste inside an editable iframe. You should see 'foo bar baz'
below.</p> |
23 <iframe src="../resources/contenteditable-iframe-src.html" onload="foo();"></ifr
ame> | 24 <iframe srcdoc="<body contenteditable></body>" onload="runTest()"></iframe> |
| 25 <div id="log"></div> |
OLD | NEW |