| OLD | NEW |
| 1 <html xmlns="http://www.w3.org/1999/xhtml"> | 1 <!doctype html> |
| 2 <head> | 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../editing.js" language="javascript" type="text/javascript"
></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script language="javascript" type="text/javascript"> | 4 <script src="../assert_selection.js"></script> |
| 5 function log(str) { | 5 <script> |
| 6 var li = document.createElement("li"); | 6 test(() => { |
| 7 li.appendChild(document.createTextNode(str)); | 7 assert_not_equals(window.eventSender, undefined, |
| 8 var console = document.getElementById("console"); | 8 'This test requires window.eventSender'); |
| 9 console.appendChild(li); | 9 assert_not_equals(window.internals, undefined, |
| 10 } | 10 'This test requires window.internals'); |
| 11 function sendBackwardDeleteKey() { | 11 ['mac', 'win', 'unix', 'android'].forEach(platform => |
| 12 if (window.eventSender) | 12 assert_selection( |
| 13 eventSender.keyDown("Backspace", null); | 13 '<div contenteditable>\u0E27\u0E31|</div>', |
| 14 } | 14 selection => { |
| 15 function runTestOn(platform) { | |
| 16 var testarea = document.getElementById("test"); | |
| 17 if (window.internals) | |
| 18 internals.settings.setEditingBehavior(platform); | 15 internals.settings.setEditingBehavior(platform); |
| 19 | 16 selection.document.defaultView.focus(); |
| 20 testarea.focus(); | 17 eventSender.keyDown('Backspace', null); |
| 21 moveSelectionForwardByCharacterCommand(); | 18 selection.document.execCommand('undo'); |
| 22 moveSelectionForwardByCharacterCommand(); | 19 }, |
| 23 sendBackwardDeleteKey(); | 20 platform === 'mac' |
| 24 execUndoCommand(); | 21 ? '<div contenteditable>\u0E27|\u0E31^</div>' |
| 25 if (testarea.textContent == "\u0E27\u0E31") | 22 : '<div contenteditable>\u0E27\u0E31|</div>', |
| 26 log("Succeeded for " + platform); | 23 `${platform}: Undo of backspace key on ligature U+0E27 and U+0E31`))
; |
| 27 else | 24 }); |
| 28 log("Failed. Actual: \"" + testarea.value + "\", Expected: \"\u0
E27\u0E31\""); | 25 </script> |
| 29 } | |
| 30 function editingTest() { | |
| 31 if (window.testRunner) | |
| 32 testRunner.dumpAsText(); | |
| 33 runTestOn("mac"); | |
| 34 runTestOn("win"); | |
| 35 runTestOn("unix"); | |
| 36 runTestOn("android"); | |
| 37 } | |
| 38 </script> | |
| 39 <title>Editing Test (Undo deleting a ligature)</title> | |
| 40 </head> | |
| 41 <body> | |
| 42 <p>This test tests whether the undo command works when the BackSpace key
deletes the last character of a ligature "วั".</p> | |
| 43 <p>If this test succeeds, you can see "วั" (U+0E27,U+0E31)
and a string "succeeded" for each platform below.</p> | |
| 44 <div id="test" contenteditable>วั</div> | |
| 45 <ul id="console"></ul> | |
| 46 <script language="javascript" type="text/javascript"> | |
| 47 runEditingTest(); | |
| 48 </script> | |
| 49 </body> | |
| 50 </html> | |
| OLD | NEW |