Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/ime-composition-events-001.html

Issue 2530843003: Introduce InsertIncrementalTextCommand to respect existing style for composition (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../resources/js-test.js"></script> 3 <script src="../../resources/js-test.js"></script>
4 </head> 4 </head>
5 <body> 5 <body>
6 <input id="test" type="text"> 6 <input id="test" type="text">
7 <script> 7 <script>
8 description('This tests that calling input-method functions sends Composition Ev ents and Text Events introduced in DOM Level 3. ' + 8 description('This tests that calling input-method functions sends Composition Ev ents and Text Events introduced in DOM Level 3. ' +
9 'To test manually, enable an IME, input CJK characters, and see this page doesn\ 't show \'FAIL\' lines.'); 9 'To test manually, enable an IME, input CJK characters, and see this page doesn\ 't show \'FAIL\' lines.');
10 </script> 10 </script>
11 <script> 11 <script>
12 function logCompositionStart(event) { 12 function logCompositionStart(event) {
13 shouldBeEqualToString('event.type', 'compositionstart'); 13 shouldBeEqualToString('event.type', 'compositionstart');
14 testPassed('event.data is "' + event.data + '"'); 14 testPassed('event.data is "' + event.data + '"');
15 } 15 }
16 16
17 function logCompositionUpdate(event) { 17 function logCompositionUpdate(event) {
18 shouldBeEqualToString('event.type', 'compositionupdate'); 18 shouldBeEqualToString('event.type', 'compositionupdate');
19 testPassed('event.data is "' + event.data + '"'); 19 testPassed('event.data is "' + event.data + '"');
20 } 20 }
21 21
22 function logCompositionEnd(event) { 22 function logCompositionEnd(event) {
23 shouldBeEqualToString('event.type', 'compositionend'); 23 shouldBeEqualToString('event.type', 'compositionend');
24 testPassed('event.data is "' + event.data + '"'); 24 testPassed('event.data is "' + event.data + '"');
25 } 25 }
26 26
yabinh 2016/11/25 04:36:27 Replacing textInput event with beforeinput and inp
chongz 2016/11/28 16:01:04 I think we cannot simply remove 'textInput' event
yabinh 2016/12/02 08:41:55 'textInput' event is kept in patch set 3 and 4.
27 function logTextInput(event) { 27 function logBeforeInput(event) {
28 shouldBeEqualToString('event.type', 'textInput'); 28 shouldBeEqualToString('event.type', 'beforeinput');
29 testPassed('event.data is "' + event.data + '"'); 29 testPassed('event.data is "' + event.data + '"');
30 } 30 }
31 31
32 function logInput(event) {
33 shouldBeEqualToString('event.type', 'input');
34 testPassed('event.data is "' + event.data + '"');
35 }
36
32 var test = document.getElementById('test'); 37 var test = document.getElementById('test');
33 test.focus(); 38 test.focus();
34 39
35 // Add event listeners to the <input> node. 40 // Add event listeners to the <input> node.
36 test.addEventListener('compositionstart', logCompositionStart, false); 41 test.addEventListener('compositionstart', logCompositionStart, false);
37 test.addEventListener('compositionupdate', logCompositionUpdate, false); 42 test.addEventListener('compositionupdate', logCompositionUpdate, false);
38 test.addEventListener('compositionend', logCompositionEnd, false); 43 test.addEventListener('compositionend', logCompositionEnd, false);
39 test.addEventListener('textInput', logTextInput, false); 44 test.addEventListener('beforeinput', logBeforeInput, false);
45 test.addEventListener('input', logInput, false);
40 46
41 // Case 1: Compose a text and commit it. 47 // Case 1: Compose a text and commit it.
42 textInputController.setMarkedText('1', 0, 1); 48 textInputController.setMarkedText('1', 0, 1);
43 textInputController.setMarkedText('2', 0, 1); 49 textInputController.setMarkedText('2', 0, 1);
44 textInputController.setMarkedText('3', 0, 1); 50 textInputController.setMarkedText('3', 0, 1);
45 textInputController.insertText('4'); 51 textInputController.insertText('4');
46 52
47 // Case 2: Compose a text but cancel it. 53 // Case 2: Compose a text but cancel it.
48 textInputController.setMarkedText('5', 0, 1); 54 textInputController.setMarkedText('5', 0, 1);
49 textInputController.setMarkedText('6', 0, 1); 55 textInputController.setMarkedText('6', 0, 1);
(...skipping 11 matching lines...) Expand all
61 test.value = 'I have a pen'; 67 test.value = 'I have a pen';
62 test.selectionStart = 2; 68 test.selectionStart = 2;
63 test.selectionEnd = 6; 69 test.selectionEnd = 6;
64 textInputController.setMarkedText('lost', 0, 1); 70 textInputController.setMarkedText('lost', 0, 1);
65 shouldBeEqualToString('test.value', 'I lost a pen'); 71 shouldBeEqualToString('test.value', 'I lost a pen');
66 textInputController.insertText('made'); 72 textInputController.insertText('made');
67 shouldBeEqualToString('test.value', 'I made a pen'); 73 shouldBeEqualToString('test.value', 'I made a pen');
68 </script> 74 </script>
69 </body> 75 </body>
70 </html> 76 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698