| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../../resources/js-test.js"></script> | |
| 4 </head> | |
| 5 <body> | |
| 6 <input id="input"><textarea id="textarea"></textarea> | |
| 7 <script> | |
| 8 description('This tests composition{Start,End}Offset attributes of InputMethodCo
ntext.'); | |
| 9 | |
| 10 var input = document.getElementById('input'); | |
| 11 var context = input.inputMethodContext; | |
| 12 input.focus(); | |
| 13 | |
| 14 textInputController.setMarkedText('abcde', 1, 3); | |
| 15 shouldEvaluateTo('context.compositionStartOffset', 0); | |
| 16 shouldEvaluateTo('context.compositionEndOffset', 5); | |
| 17 context.confirmComposition(); | |
| 18 shouldBeEqualToString('input.value', 'abcde'); | |
| 19 | |
| 20 textInputController.setMarkedText('fgh', 0, 3); | |
| 21 shouldEvaluateTo('context.compositionStartOffset', 5); | |
| 22 shouldEvaluateTo('context.compositionEndOffset', 8); | |
| 23 context.confirmComposition(); | |
| 24 shouldBeEqualToString('input.value', 'abcdefgh'); | |
| 25 | |
| 26 input.value = '12345'; | |
| 27 input.selectionStart = 3; | |
| 28 input.selectionEnd = 3; | |
| 29 textInputController.setMarkedText('XYZ', 0, 3); | |
| 30 shouldBeEqualToString('input.value', '123XYZ45'); | |
| 31 shouldEvaluateTo('context.compositionStartOffset', 3); | |
| 32 shouldEvaluateTo('context.compositionEndOffset', 6); | |
| 33 context.confirmComposition(); | |
| 34 | |
| 35 var textarea = document.getElementById('textarea'); | |
| 36 var context2 = textarea.inputMethodContext; | |
| 37 textarea.focus(); | |
| 38 | |
| 39 textInputController.setMarkedText('abcde', 1, 3); | |
| 40 shouldEvaluateTo('context2.compositionStartOffset', 0); | |
| 41 shouldEvaluateTo('context2.compositionEndOffset', 5); | |
| 42 context2.confirmComposition(); | |
| 43 shouldBeEqualToString('textarea.value', 'abcde'); | |
| 44 | |
| 45 textInputController.setMarkedText('fgh', 0, 3); | |
| 46 shouldEvaluateTo('context2.compositionStartOffset', 5); | |
| 47 shouldEvaluateTo('context2.compositionEndOffset', 8); | |
| 48 context2.confirmComposition(); | |
| 49 shouldBeEqualToString('textarea.value', 'abcdefgh'); | |
| 50 | |
| 51 textarea.value = '12345'; | |
| 52 textarea.selectionStart = 3; | |
| 53 textarea.selectionEnd = 3; | |
| 54 textInputController.setMarkedText('XYZ', 0, 3); | |
| 55 shouldBeEqualToString('textarea.value', '123XYZ45'); | |
| 56 shouldEvaluateTo('context2.compositionStartOffset', 3); | |
| 57 shouldEvaluateTo('context2.compositionEndOffset', 6); | |
| 58 context2.confirmComposition(); | |
| 59 </script> | |
| 60 </body> | |
| 61 </html> | |
| OLD | NEW |