| OLD | NEW |
| 1 <html> | 1 <!doctype html> |
| 2 <head> | 2 <script src="../../resources/testharness.js"></script> |
| 3 <title>Editing Test (Inserting a Thai character after a Thai prepend character)<
/title> | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script src="../editing.js" language="javascript" type="text/javascript"></scrip
t> | 4 <script src="../assert_selection.js"></script> |
| 5 <script language="javascript" type="text/javascript"> | 5 <div id="log"></div> |
| 6 function log(str) { | 6 <script> |
| 7 var li = document.createElement("li"); | 7 test(() => assert_selection( |
| 8 li.appendChild(document.createTextNode(str)); | 8 '<div contenteditable>|</div>', |
| 9 var console = document.getElementById("console"); | 9 selection => { |
| 10 console.appendChild(li); | 10 selection.document.execCommand('insertText', false, '\u0E2D'); |
| 11 } | 11 selection.document.execCommand('insertText', false, '\u0E22'); |
| 12 function editingTest() { | 12 selection.document.execCommand('insertText', false, '\u0E32'); |
| 13 if (window.testRunner) | 13 selection.document.execCommand('insertText', false, '\u0E01'); |
| 14 testRunner.dumpAsText(); | 14 selection.document.execCommand('insertText', false, '\u0E0D'); |
| 15 var testarea = document.getElementById("test"); | 15 selection.document.execCommand('insertText', false, '\u0E35'); |
| 16 testarea.focus(); | 16 selection.document.execCommand('insertText', false, '\u0E48'); |
| 17 typeCharacterCommand(String.fromCharCode(0x0E2D)); | 17 selection.document.execCommand('insertText', false, '\u0E1B'); |
| 18 typeCharacterCommand(String.fromCharCode(0x0E22)); | 18 selection.document.execCommand('insertText', false, '\u0E38'); |
| 19 typeCharacterCommand(String.fromCharCode(0x0E32)); | 19 selection.document.execCommand('insertText', false, '\u0E48'); |
| 20 typeCharacterCommand(String.fromCharCode(0x0E01)); | 20 selection.document.execCommand('insertText', false, '\u0E19'); |
| 21 typeCharacterCommand(String.fromCharCode(0x0E0D)); | 21 selection.modify('move', 'backward', 'character'); |
| 22 typeCharacterCommand(String.fromCharCode(0x0E35)); | 22 selection.modify('move', 'backward', 'character'); |
| 23 typeCharacterCommand(String.fromCharCode(0x0E48)); | 23 selection.modify('move', 'backward', 'character'); |
| 24 typeCharacterCommand(String.fromCharCode(0x0E1B)); | 24 selection.document.execCommand('insertText', false, '\u0E44'); |
| 25 typeCharacterCommand(String.fromCharCode(0x0E38)); | 25 selection.document.execCommand('insertText', false, '\u0E1B'); |
| 26 typeCharacterCommand(String.fromCharCode(0x0E48)); | 26 }, |
| 27 typeCharacterCommand(String.fromCharCode(0x0E19)); | 27 '<div contenteditable>\u0E2D\u0E22\u0E32\u0E01\u0E44\u0E1B|\u0E0D\u0E35\u0E4
8\u0E1B\u0E38\u0E48\u0E19</div>'), |
| 28 moveSelectionBackwardByCharacterCommand(); | 28 'insert a Thai character after a Thai "prepend" character'); |
| 29 moveSelectionBackwardByCharacterCommand(); | |
| 30 moveSelectionBackwardByCharacterCommand(); | |
| 31 typeCharacterCommand(String.fromCharCode(0x0E44)); | |
| 32 typeCharacterCommand(String.fromCharCode(0x0E1B)); | |
| 33 var expected_result = "\u0E2D\u0E22\u0E32\u0E01\u0E44\u0E1B\u0E0D\u0E35\u0E4
8\u0E1B\u0E38\u0E48\u0E19"; | |
| 34 if (testarea.textContent == expected_result) | |
| 35 log("Succeeded."); | |
| 36 else | |
| 37 log("Failed. Actual: \"" + testarea.textContent.value + "\", Expected: \
"" + expected_result + "\"."); | |
| 38 } | |
| 39 </script> | 29 </script> |
| 40 </head> | |
| 41 <body> | |
| 42 <p>This test tests whether we can insert a Thai character after a Thai "prepend"
character.</p> | |
| 43 <p>If this test succeeds, you can see a string "succeeded" below.</p> | |
| 44 <div contenteditable id="test"></div> | |
| 45 <ul id="console"></ul> | |
| 46 <script language="javascript" type="text/javascript"> | |
| 47 runEditingTest(); | |
| 48 </script> | |
| 49 </body> | |
| 50 </html> | |
| OLD | NEW |