Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit c484213

Browse files
committed
test(input): add test for IE composition bug
1 parent 2789ccb commit c484213

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/ng/directive/inputSpec.js

+14
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,20 @@ describe('input', function() {
134134
browserTrigger(inputElm, 'compositionend');
135135
expect($rootScope.name).toEqual('caitp');
136136
});
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+
});
137151
});
138152

139153

0 commit comments

Comments
 (0)