From a8a0e047c1dcdf506de523b2628014e34f6a3438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ney=20Sim=C3=B5es?= Date: Sat, 23 Sep 2017 02:45:02 -0300 Subject: [PATCH] fix(uiDateMask): return null should handle corner cases (#295) BREAKING CHANGE uiDateMask used to return the input value when empty now it will return null --- src/global/date/date.js | 2 +- src/global/date/date.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/global/date/date.js b/src/global/date/date.js index 82992486..22412d32 100644 --- a/src/global/date/date.js +++ b/src/global/date/date.js @@ -29,7 +29,7 @@ function DateMaskDirective($locale) { function formatter(value) { if (ctrl.$isEmpty(value)) { - return value; + return null; } var cleanValue = value; diff --git a/src/global/date/date.test.js b/src/global/date/date.test.js index 5baebc9b..abc73505 100644 --- a/src/global/date/date.test.js +++ b/src/global/date/date.test.js @@ -86,7 +86,7 @@ describe('ui-date-mask', function() { tests.forEach(function(test) { $rootScope.model = test.modelValue; $rootScope.$digest(); - expect(model.$viewValue).toBe(test.viewValue); + expect(model.$viewValue).toBe(null); }); })); });