Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 0fd93da

Browse files
authored
Fix input week test
The test previously passed without this patch, which is bad.
1 parent 06709f9 commit 0fd93da

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/ng/directive/inputSpec.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,16 +1093,18 @@ describe('input', function() {
10931093

10941094
it('should validate when timezone is provided.', function() {
10951095
inputElm = helper.compileInput('<input type="week" ng-model="value" name="alias" ' +
1096-
'max="{{ maxVal }}" ng-model-options="{timezone: \'UTC\', allowInvalid: true}"/>');
1097-
$rootScope.maxVal = '2013-W01';
1098-
$rootScope.value = new Date(Date.UTC(2013, 0, 1, 0, 0, 0));
1096+
'max="{{ maxVal }}" ng-model-options="{timezone: \'-2400\', allowInvalid: true}"/>');
1097+
// The calendar week comparison date is January 17. Setting the timezone to -2400
1098+
// makes the January 18 date value valid.
1099+
$rootScope.maxVal = '2013-W03';
1100+
$rootScope.value = new Date(Date.UTC(2013, 0, 18));
10991101
$rootScope.$digest();
11001102

11011103
expect($rootScope.form.alias.$error.max).toBeFalsy();
11021104
expect($rootScope.form.alias.$valid).toBeTruthy();
11031105

11041106
$rootScope.value = '';
1105-
helper.changeInputValueTo('2013-W01');
1107+
helper.changeInputValueTo('2013-W03');
11061108
expect(inputElm).toBeValid();
11071109
expect($rootScope.form.alias.$error.max).toBeFalsy();
11081110
expect($rootScope.form.alias.$valid).toBeTruthy();

0 commit comments

Comments
 (0)