File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,20 @@ describe('input', function() {
134
134
browserTrigger ( inputElm , 'compositionend' ) ;
135
135
expect ( $rootScope . name ) . toEqual ( 'caitp' ) ;
136
136
} ) ;
137
+
138
+
139
+ it ( 'should end composition on "compositionupdate" when event.data is ""' , function ( ) {
140
+ // This tests a bug workaround for IE9-11
141
+ // During composition, when an input is de-focussed by clicking away from it,
142
+ // the compositionupdate event is called with '', followed by a change event.
143
+ var inputElm = helper . compileInput ( '<input type="text" ng-model="name" name="alias" />' ) ;
144
+ browserTrigger ( inputElm , 'compositionstart' ) ;
145
+ helper . changeInputValueTo ( 'caitp' ) ;
146
+ expect ( $rootScope . name ) . toBeUndefined ( ) ;
147
+ browserTrigger ( inputElm , 'compositionupdate' , { data : '' } ) ;
148
+ browserTrigger ( inputElm , 'change' ) ;
149
+ expect ( $rootScope . name ) . toEqual ( 'caitp' ) ;
150
+ } ) ;
137
151
} ) ;
138
152
139
153
You can’t perform that action at this time.
0 commit comments