Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
test(*): fix 4 tests that failed on specific dates
Browse files Browse the repository at this point in the history
  • Loading branch information
urish committed Jul 31, 2015
1 parent 9fbd35e commit a980f8c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('<span am-time-ago="testDate" am-format="YYYY#DD#MM"></span>');
element = $compile(element)($rootScope);
$rootScope.$digest();
Expand All @@ -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('<span am-time-ago="testDate" am-format="{{dateFormat}}"></span>');
element = $compile(element)($rootScope);
$rootScope.$digest();
Expand All @@ -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('<span am-time-ago="testDate"></span>');
element = $compile(element)($rootScope);
$rootScope.$digest();
Expand All @@ -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('<span am-format="MM@YYYY@DD" am-time-ago="testDate"></span>');
element = $compile(element)($rootScope);
$rootScope.$digest();
Expand Down

0 comments on commit a980f8c

Please sign in to comment.