From f0d323efe210022a70716b99ac7d245f72c84876 Mon Sep 17 00:00:00 2001 From: Lucas Galfaso Date: Sat, 15 Aug 2015 12:40:23 +0200 Subject: [PATCH] test(input): test for #12106 Add a test that checks that an value is not set when the value is equal to the current value --- test/ng/directive/inputSpec.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/ng/directive/inputSpec.js b/test/ng/directive/inputSpec.js index 3c92625a1b43..a28f7ed455ba 100644 --- a/test/ng/directive/inputSpec.js +++ b/test/ng/directive/inputSpec.js @@ -72,6 +72,25 @@ describe('input', function() { expect($rootScope.form.$$renameControl).not.toHaveBeenCalled(); }); + + it('should not set the `val` property when the value is equal to the current value', inject(function($rootScope, $compile) { + // This is a workaround for Firefox validation. Look at #12102. + var input = jqLite(''); + var setterCalls = 0; + $rootScope.foo = ''; + Object.defineProperty(input[0], 'value', { + get: function() { + return ''; + }, + set: function() { + setterCalls++; + } + }); + $compile(input)($rootScope); + $rootScope.$digest(); + expect(setterCalls).toBe(0); + })); + describe('compositionevents', function() { it('should not update the model between "compositionstart" and "compositionend" on non android', function() {