| OLD | NEW |
| 1 <body onload="runTest()"> | 1 <!doctype html> |
| 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script src="../assert_selection.js"></script> |
| 2 <script> | 5 <script> |
| 3 if (window.testRunner) | 6 test(() => { |
| 4 testRunner.dumpEditingCallbacks(); | 7 assert_not_equals(window.internals, undefined, |
| 8 'This test requires window.internals to access clipboard'); |
| 9 assert_selection( |
| 10 '<div contenteditable>|a b a</div>', |
| 11 selection => { |
| 12 selection.document.execCommand('findString', false, 'a b'); |
| 13 selection.document.execCommand('copy'); |
| 14 selection.document.execCommand('findString', false, 'a'); |
| 15 selection.document.execCommand('paste'); |
| 16 }, |
| 17 '<div contenteditable>a b a b|</div>'); |
| 18 }, 'simulate find and replace'); |
| 5 </script> | 19 </script> |
| 6 <p>This tests find and replace inside an editable iframe. You should see 'A B A
B' below. With bug 4462420, you would see 'A B B A'.</p> | |
| 7 <iframe src="../resources/contenteditable-iframe-src.html"></iframe> | |
| 8 | |
| 9 <script> | |
| 10 function runTest() { | |
| 11 document.body.offsetTop; | |
| 12 | |
| 13 var frame = frames[0]; | |
| 14 var sel = frame.getSelection(); | |
| 15 var doc = frame.document; | |
| 16 | |
| 17 sel.collapse(doc.body, 0); | |
| 18 doc.execCommand("InsertText", false, "A B A"); | |
| 19 sel.collapse(doc.body, 0); | |
| 20 doc.execCommand("FindString", false, "A B"); | |
| 21 doc.execCommand("Copy"); | |
| 22 doc.execCommand("FindString", false, "A"); | |
| 23 doc.execCommand("Paste"); | |
| 24 } | |
| 25 </script> | |
| 26 </body> | |
| OLD | NEW |