From a980f8c6157131cbaf8b2ce69453910187386d94 Mon Sep 17 00:00:00 2001 From: Uri Shaked Date: Fri, 31 Jul 2015 20:10:39 +0300 Subject: [PATCH] test(*): fix 4 tests that failed on specific dates --- tests.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests.js b/tests.js index 91da293..1fb3f9e 100644 --- a/tests.js +++ b/tests.js @@ -368,7 +368,8 @@ describe('module angularMoment', function () { describe('am-format attribute', function () { it('should support custom date format', function () { var today = new Date(); - $rootScope.testDate = today.getFullYear() + '#' + today.getDate() + '#' + today.getMonth(); + var date = Math.min(today.getDate(), 28); + $rootScope.testDate = today.getFullYear() + '#' + date + '#' + today.getMonth(); var element = angular.element(''); element = $compile(element)($rootScope); $rootScope.$digest(); @@ -377,7 +378,8 @@ describe('module angularMoment', function () { it('should support angular expressions in date format', function () { var today = new Date(); - $rootScope.testDate = today.getMonth() + '@' + today.getFullYear() + '@' + today.getDate(); + var date = Math.min(today.getDate(), 28); + $rootScope.testDate = today.getMonth() + '@' + today.getFullYear() + '@' + date; var element = angular.element(''); element = $compile(element)($rootScope); $rootScope.$digest(); @@ -391,7 +393,8 @@ describe('module angularMoment', function () { it('should be used when no `am-format` attribute is found', function () { angularMomentConfig.format = 'MM@YYYY@DD'; var today = new Date(); - $rootScope.testDate = today.getMonth() + '@' + today.getFullYear() + '@' + today.getDate(); + var date = Math.min(today.getDate(), 28); + $rootScope.testDate = today.getMonth() + '@' + today.getFullYear() + '@' + date; var element = angular.element(''); element = $compile(element)($rootScope); $rootScope.$digest(); @@ -401,7 +404,8 @@ describe('module angularMoment', function () { it('should be overridable by `am-format` attribute', function () { angularMomentConfig.format = 'YYYY@MM@@DD'; var today = new Date(); - $rootScope.testDate = today.getMonth() + '@' + today.getFullYear() + '@' + today.getDate(); + var date = Math.min(today.getDate(), 28); + $rootScope.testDate = today.getMonth() + '@' + today.getFullYear() + '@' + date; var element = angular.element(''); element = $compile(element)($rootScope); $rootScope.$digest();