test_bug1543312.html (1779B)
1 <!DOCTYPE html> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1543312 5 --> 6 <head> 7 <title>Test for Bug 1543312</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script src="/tests/SimpleTest/EventUtils.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 12 <script> 13 SimpleTest.expectAssertions(0, 1); 14 15 add_task(async function() { 16 let iframe = document.getElementById("iframe2"); 17 iframe.style.display = "none"; 18 iframe.offsetHeight; // reflow 19 iframe.style.display = ""; 20 iframe.offsetHeight; // reflow 21 22 iframe.focus(); 23 let edit = iframe.contentDocument.getElementById("edit"); 24 edit.focus(); 25 synthesizeCompositionChange({ 26 "composition": { 27 "string": "foo", 28 "clauses": [{ 29 "length": 3, 30 "attr": COMPOSITION_ATTR_RAW_CLAUSE 31 }], 32 "caret": { 33 "start": 3, 34 "length": 0 35 } 36 } 37 }); 38 synthesizeComposition({type: "compositioncommitasis"}); 39 synthesizeCompositionChange({ 40 "composition": { 41 "string": "bar", 42 "clauses": [{ 43 "length": 3, 44 "attr": COMPOSITION_ATTR_RAW_CLAUSE 45 }], 46 "caret": { 47 "start": 3, 48 "length": 0 49 } 50 } 51 }); 52 synthesizeComposition({type: "compositioncommitasis"}); 53 54 is(edit.textContent, "foobar", "caret is updated correctly"); 55 56 synthesizeKey("1"); 57 is(edit.textContent, "foobar1", "caret is updated correctly"); 58 }); 59 </script> 60 </head> 61 <body> 62 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1543312">Mozilla Bug 1543312</a> 63 <p id="display"></p> 64 65 <div> 66 <iframe id="iframe1" srcdoc="<div contenteditable></div>"></iframe> 67 <iframe id="iframe2" srcdoc="<div id=edit contenteditable></div>"></iframe> 68 </div> 69 </body> 70 </html>