Skip to content

Commit

Permalink
unit tests should be timezone aware
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob McGuinness committed Oct 7, 2015
1 parent 88bf049 commit 349f7e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/ui/datepicker/tests/datepicker-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ describe('avDatepicker', function() {
});

it('should correctly initialize ISO 8601 date from MODEL', function() {
availity.mock.$scope.selectedDate = '1986-01-22T06:00:00.000+0000';
availity.mock.$scope.selectedDate = '2014-12-31T23:00:00Z';
angular.mock.TzDate(+1, '2014-12-31T23:00:00Z')
$el = availity.mock.compileDirective(fixtures['default']);

expect($el.val()).toBe('01/22/1986');
expect($el.val()).toBe('12/31/2014');
});

it('should correctly ignore undefined date from MODEL', function() {
Expand Down
5 changes: 3 additions & 2 deletions lib/ui/validation/tests/field-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,12 @@ describe('avValField', function() {
});

it('should validate ISO 8601 string date model using default format', function() {
availity.mock.$scope.demo.date = '1986-01-22T06:00:00.000+0000';
availity.mock.$scope.demo.date = '2014-12-31T23:00:00Z';
angular.mock.TzDate(+1, '2014-12-31T23:00:00Z')
availity.mock.$scope.$digest();

expect(availity.mock.$scope.myForm.date.$invalid).toBe(false);
expect(availity.mock.$scope.myForm.date.$viewValue).toBe('01/22/1986');
expect(availity.mock.$scope.myForm.date.$viewValue).toBe('12/31/2014');
});

});
Expand Down

0 comments on commit 349f7e2

Please sign in to comment.