From a4e6d962d78b26f5112d48c4f88c1e6234d0cae7 Mon Sep 17 00:00:00 2001 From: Chia-liang Kao Date: Tue, 29 Oct 2013 00:42:47 +0800 Subject: feat(input): hold listener during text composition When composing text in CJKV, intermediate buffer for unfinished text should not be updating the bound scope variables. Closes #4684 --- test/ng/directive/inputSpec.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/ng/directive') diff --git a/test/ng/directive/inputSpec.js b/test/ng/directive/inputSpec.js index 3783c9ed..c6f5558a 100644 --- a/test/ng/directive/inputSpec.js +++ b/test/ng/directive/inputSpec.js @@ -454,6 +454,20 @@ describe('input', function() { expect(scope.name).toEqual('adam'); }); + it('should not update the model between "compositionstart" and "compositionend"', function() { + compileInput(''); + changeInputValueTo('a'); + expect(scope.name).toEqual('a'); + if (!(msie < 9)) { + browserTrigger(inputElm, 'compositionstart'); + changeInputValueTo('adam'); + expect(scope.name).toEqual('a'); + browserTrigger(inputElm, 'compositionend'); + } + changeInputValueTo('adam'); + expect(scope.name).toEqual('adam'); + }); + describe('"paste" and "cut" events', function() { beforeEach(function() { // Force browser to report a lack of an 'input' event -- cgit v1.2.3