-
Notifications
You must be signed in to change notification settings - Fork 27.4k
chore(travis): test on IE Edge #14401
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,9 @@ | |
describe('input', function() { | ||
var helper = {}, $compile, $rootScope, $browser, $sniffer, $timeout, $q; | ||
|
||
// UA sniffing to exclude Edge from some date input tests | ||
var isEdge = /\bEdge\//.test(window.navigator.userAgent); | ||
|
||
generateInputCompilerHelper(helper); | ||
|
||
beforeEach(inject(function(_$compile_, _$rootScope_, _$browser_, _$sniffer_, _$timeout_, _$q_) { | ||
|
@@ -688,18 +691,20 @@ describe('input', function() { | |
expect($rootScope.form.alias.$error.month).toBeTruthy(); | ||
}); | ||
|
||
it('should allow four or more digits in year', function() { | ||
var inputElm = helper.compileInput('<input type="month" ng-model="value" ng-model-options="{timezone: \'UTC\'}"/>'); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Narretz when you were preparing this change, were you able to determine the root cause of these inputSpec failures? I've been looking at these failures recently as part of the work @jdalton mentioned to include AngularJS tests in our Edge Regression testing. I have concluded that this line If there is an Edge bug behind this I'd love to make sure it gets filed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AmazingJaze I assumed that Edge simply doesn't allow setting years with more than 4 digits in all the date input elements, so when you enter There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is indeed the case that Edge does not support dates with years past 9999. The spec does explicitly allow years with more than 4 digits (but not all browsers support it). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at this plnkr, http://plnkr.co/edit/TkRo7GD139Pab0qC5ZEm?p=preview it seems to be the case that there is no way to enter a year with more than 4 digits in Edge currently. In Chrome, I can always use the keyboard to input the parts of the date, and so I can also enter 5 digit dates. In Edge it looks like I can only select a date from the picker. Is this correct? This seems like a UX issue to me, and a bug in Edge. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAIK, it is indeed not possible to set the date without using the picker (unless you open up dev tools and set the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
helper.changeInputValueTo('10123-03'); | ||
expect(+$rootScope.value).toBe(Date.UTC(10123, 2, 1, 0, 0, 0)); | ||
if (!isEdge) { | ||
it('should allow four or more digits in year', function() { | ||
var inputElm = helper.compileInput('<input type="month" ng-model="value" ng-model-options="{timezone: \'UTC\'}"/>'); | ||
|
||
$rootScope.$apply(function() { | ||
$rootScope.value = new Date(Date.UTC(20456, 3, 1, 0, 0, 0)); | ||
}); | ||
expect(inputElm.val()).toBe('20456-04'); | ||
}); | ||
helper.changeInputValueTo('10123-03'); | ||
expect(+$rootScope.value).toBe(Date.UTC(10123, 2, 1, 0, 0, 0)); | ||
|
||
$rootScope.$apply(function() { | ||
$rootScope.value = new Date(Date.UTC(20456, 3, 1, 0, 0, 0)); | ||
}); | ||
expect(inputElm.val()).toBe('20456-04'); | ||
}); | ||
} | ||
|
||
it('should only change the month of a bound date', function() { | ||
var inputElm = helper.compileInput('<input type="month" ng-model="value" ng-model-options="{timezone: \'UTC\'}" />'); | ||
|
@@ -899,17 +904,19 @@ describe('input', function() { | |
expect(inputElm).toBeValid(); | ||
}); | ||
|
||
it('should allow four or more digits in year', function() { | ||
var inputElm = helper.compileInput('<input type="week" ng-model="value" ng-model-options="{timezone: \'UTC\'}"/>'); | ||
if (!isEdge) { | ||
it('should allow four or more digits in year', function() { | ||
var inputElm = helper.compileInput('<input type="week" ng-model="value" ng-model-options="{timezone: \'UTC\'}"/>'); | ||
|
||
helper.changeInputValueTo('10123-W03'); | ||
expect(+$rootScope.value).toBe(Date.UTC(10123, 0, 21)); | ||
helper.changeInputValueTo('10123-W03'); | ||
expect(+$rootScope.value).toBe(Date.UTC(10123, 0, 21)); | ||
|
||
$rootScope.$apply(function() { | ||
$rootScope.value = new Date(Date.UTC(20456, 0, 28)); | ||
$rootScope.$apply(function() { | ||
$rootScope.value = new Date(Date.UTC(20456, 0, 28)); | ||
}); | ||
expect(inputElm.val()).toBe('20456-W04'); | ||
}); | ||
expect(inputElm.val()).toBe('20456-W04'); | ||
}); | ||
} | ||
|
||
it('should use UTC if specified in the options', function() { | ||
var inputElm = helper.compileInput('<input type="week" ng-model="value" ng-model-options="{timezone: \'UTC\'}" />'); | ||
|
@@ -1195,18 +1202,22 @@ describe('input', function() { | |
expect(+$rootScope.value).toBe(+new Date(2000, 0, 1, 1, 2, 0)); | ||
}); | ||
|
||
it('should allow four or more digits in year', function() { | ||
var inputElm = helper.compileInput('<input type="datetime-local" ng-model="value" />'); | ||
|
||
helper.changeInputValueTo('10123-01-01T01:02'); | ||
expect(+$rootScope.value).toBe(+new Date(10123, 0, 1, 1, 2, 0)); | ||
if (!isEdge) { | ||
it('should allow four or more digits in year', function() { | ||
var inputElm = helper.compileInput('<input type="datetime-local" ng-model="value" />'); | ||
|
||
helper.changeInputValueTo('10123-01-01T01:02'); | ||
expect(+$rootScope.value).toBe(+new Date(10123, 0, 1, 1, 2, 0)); | ||
|
||
$rootScope.$apply(function() { | ||
$rootScope.value = new Date(20456, 1, 1, 1, 2, 0); | ||
}); | ||
expect(inputElm.val()).toBe('20456-02-01T01:02:00.000'); | ||
} | ||
); | ||
} | ||
|
||
$rootScope.$apply(function() { | ||
$rootScope.value = new Date(20456, 1, 1, 1, 2, 0); | ||
}); | ||
expect(inputElm.val()).toBe('20456-02-01T01:02:00.000'); | ||
} | ||
); | ||
|
||
it('should label parse errors as `datetimelocal`', function() { | ||
var inputElm = helper.compileInput('<input type="datetime-local" ng-model="val" name="alias" />', { | ||
|
@@ -1800,19 +1811,20 @@ describe('input', function() { | |
} | ||
); | ||
|
||
it('should allow four or more digits in year', function() { | ||
var inputElm = helper.compileInput('<input type="date" ng-model="value" ng-model-options="{timezone: \'UTC\'}" />'); | ||
|
||
helper.changeInputValueTo('10123-01-01'); | ||
expect(+$rootScope.value).toBe(Date.UTC(10123, 0, 1, 0, 0, 0)); | ||
if (!isEdge) { | ||
it('should allow four or more digits in year', function() { | ||
var inputElm = helper.compileInput('<input type="date" ng-model="value" ng-model-options="{timezone: \'UTC\'}" />'); | ||
|
||
$rootScope.$apply(function() { | ||
$rootScope.value = new Date(Date.UTC(20456, 1, 1, 0, 0, 0)); | ||
}); | ||
expect(inputElm.val()).toBe('20456-02-01'); | ||
} | ||
); | ||
helper.changeInputValueTo('10123-01-01'); | ||
expect(+$rootScope.value).toBe(Date.UTC(10123, 0, 1, 0, 0, 0)); | ||
|
||
$rootScope.$apply(function() { | ||
$rootScope.value = new Date(Date.UTC(20456, 1, 1, 0, 0, 0)); | ||
}); | ||
expect(inputElm.val()).toBe('20456-02-01'); | ||
} | ||
); | ||
} | ||
|
||
it('should label parse errors as `date`', function() { | ||
var inputElm = helper.compileInput('<input type="date" ng-model="val" name="alias" />', { | ||
|
@@ -4224,10 +4236,14 @@ describe('input', function() { | |
}); | ||
|
||
expect(inputElm[0].value).toBe(''); | ||
// Support: IE 9-11 | ||
// Support: IE 9-11, Edge | ||
// In IE it is not possible to remove the `value` attribute from an input element. | ||
if (!msie) { | ||
if (!msie && !isEdge) { | ||
expect(inputElm[0].getAttribute('value')).toBeNull(); | ||
} else { | ||
// Support: IE 9-11, Edge | ||
// This will fail if the Edge bug gets fixed | ||
expect(inputElm[0].getAttribute('value')).toBe('something'); | ||
} | ||
}); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a BrowserStack entry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added