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

Side by Side Diff: LayoutTests/fast/events/ime-composition-events-segments.html

Issue 1162853002: Remove IME API from Blink (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove interface in WebWidgets.h Created 5 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/fast/events/ime-composition-events-segments-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../../resources/js-test.js"></script>
4 </head>
5 <body>
6 <input id="test" type="text">
7 <script>
8 description('This tests that DOM L3 CompositionEvent segment related properties. ');
9
10 var expectedStart = 0;
11 var expectedEnd = 0;
12 var expectedSegments = [];
13
14 var segments;
15 var i;
16
17 function checkCompositionEvent(event) {
18 shouldBe('event.activeSegmentStart', stringify(expectedStart));
19 shouldBe('event.activeSegmentEnd', stringify(expectedEnd));
20 segments = event.getSegments();
21 shouldBe('segments.length', stringify(expectedSegments.length));
22 for (i = 0; i < expectedSegments.length; ++i) {
23 shouldBe('segments[i]', stringify(expectedSegments[i]));
24 }
25 }
26
27 function onCompositionStart(event) {
28 shouldBeEqualToString('event.type', 'compositionstart');
29 testPassed('event.data is "' + event.data + '"');
30 checkCompositionEvent(event);
31 }
32
33 function onCompositionUpdate(event) {
34 shouldBeEqualToString('event.type', 'compositionupdate');
35 testPassed('event.data is "' + event.data + '"');
36 checkCompositionEvent(event);
37 }
38
39 function onCompositionEnd(event) {
40 shouldBeEqualToString('event.type', 'compositionend');
41 testPassed('event.data is "' + event.data + '"');
42 checkCompositionEvent(event);
43 }
44
45 var test = document.getElementById('test');
46 test.focus();
47
48 test.addEventListener('compositionstart', onCompositionStart, false);
49 test.addEventListener('compositionupdate', onCompositionUpdate, false);
50 test.addEventListener('compositionend', onCompositionEnd, false);
51
52 debug('Case 1: Test from empty input field.');
53
54 expectedStart = 0;
55 expectedEnd = 3;
56 expectedSegments = [0, 3];
57 textInputController.setMarkedText('abcdefghi', expectedStart, expectedEnd - expe ctedStart);
58
59 expectedStart = 3;
60 expectedEnd = 6;
61 expectedSegments = [0, 3, 6];
62 textInputController.setMarkedText('abcdefghi', expectedStart, expectedEnd - expe ctedStart);
63
64 expectedStart = 6;
65 expectedEnd = 9;
66 expectedSegments = [0, 6];
67 textInputController.setMarkedText('abcdefghi', expectedStart, expectedEnd - expe ctedStart);
68
69 textInputController.insertText('abcdefghi');
70 shouldBeEqualToString('test.value', 'abcdefghi');
71
72 debug('Case 2: Test from non-empty input field.');
73
74 expectedStart = 0;
75 expectedEnd = 3;
76 expectedSegments = [0, 3];
77 textInputController.setMarkedText('123456789', expectedStart, expectedEnd - expe ctedStart);
78
79 expectedStart = 3;
80 expectedEnd = 6;
81 expectedSegments = [0, 3, 6];
82 textInputController.setMarkedText('123456789', expectedStart, expectedEnd - expe ctedStart);
83
84 expectedStart = 6;
85 expectedEnd = 9;
86 expectedSegments = [0, 6];
87 textInputController.setMarkedText('123456789', expectedStart, expectedEnd - expe ctedStart);
88
89 textInputController.insertText('123456789');
90
91 shouldBeEqualToString('test.value', 'abcdefghi123456789');
92 </script>
93 </body>
94 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/events/ime-composition-events-segments-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698