Permalink
Comparing changes
Open a pull request
- 2 commits
- 10 files changed
- 0 commit comments
- 1 contributor
Commits on Jan 11, 2016
Includes the following fixes (per component):
* `$sniffer`: Properly determine the expected `vendorPrefix` for MS Edge
* `input`: MS Edge does not support dates with years with more than 4 digits.
Trying to set the value of an `input[datetime-local]` to `9999-12-31T23.59.59.999` throws an
error (probably related to converting the date to one with a year with more than 4 digits,
due to timezone offset).
* `$animateCss`: Although the detected `vendorPrefix` for MS Edge is "ms", it doesn't seem to
recognize some vendor-prefixed CSS rules (e.g. `-ms-animation-*`). Other browsers (currently)
recognize either vendor-prefixed rules only or both.
Fixed by adding and retrieving styles using both prefixed and un-prefixed names.
* `$compile`: Skip failing `foreignObject` test on MS Edge.
For unknown reasons, an `<svg>` element inside a `<foreignObject>` element on MS Edge has no
size, causing the included `<circle>` element to also have no size and thus fails an
assertion (relying on the element having a non-zero size).
This seems to be an MS Edge issue; i.e. it is also reproducible without Angular.
(Tested with MS Edge version 25.10586.0.0 on Windows 10.)
Closes #13686
Unified
Split
Showing
with
99 additions
and 73 deletions.
- +13 −2 test/helpers/privateMocks.js
- +1 −1 test/helpers/privateMocksSpec.js
- +16 −11 test/ng/compileSpec.js
- +1 −1 test/ng/directive/inputSpec.js
- +2 −2 test/ng/directive/ngRepeatSpec.js
- +3 −1 test/ng/snifferSpec.js
- +2 −2 test/ngAnimate/animateCssDriverSpec.js
- +57 −49 test/ngAnimate/animateCssSpec.js
- +2 −2 test/ngAnimate/integrationSpec.js
- +2 −2 test/ngMock/angular-mocksSpec.js
| @@ -40,9 +40,8 @@ function browserSupportsCssAnimations() { | ||
| return true; | ||
| } | ||
|
|
||
| function createMockStyleSheet(doc, wind) { | ||
| function createMockStyleSheet(doc, prefix) { | ||
| doc = doc ? doc[0] : document; | ||
| wind = wind || window; | ||
|
|
||
| var node = doc.createElement('style'); | ||
| var head = doc.getElementsByTagName('head')[0]; | ||
| @@ -63,6 +62,18 @@ function createMockStyleSheet(doc, wind) { | ||
| } | ||
| }, | ||
|
|
||
| addPossiblyPrefixedRule: function(selector, styles) { | ||
| if (prefix) { | ||
| var prefixedStyles = styles.split(/\s*;\s*/g).map(function(style) { | ||
| return !style ? '' : prefix + style; | ||
| }).join('; '); | ||
|
|
||
| this.addRule(selector, prefixedStyles); | ||
| } | ||
|
|
||
| this.addRule(selector, styles); | ||
| }, | ||
|
|
||
| destroy: function() { | ||
| head.removeChild(node); | ||
| } | ||
| @@ -211,7 +211,7 @@ describe('private mocks', function() { | ||
|
|
||
| var doc = $document[0]; | ||
| var count = doc.styleSheets.length; | ||
| var stylesheet = createMockStyleSheet($document, $window); | ||
| var stylesheet = createMockStyleSheet($document); | ||
| var elm; | ||
| runs(function() { | ||
| expect(doc.styleSheets.length).toBe(count + 1); | ||
| @@ -230,6 +230,9 @@ describe('$compile', function() { | ||
|
|
||
|
|
||
| describe('svg namespace transcludes', function() { | ||
| var ua = window.navigator.userAgent; | ||
| var isEdge = /Edge/.test(ua); | ||
|
|
||
| // this method assumes some sort of sized SVG element is being inspected. | ||
| function assertIsValidSvgCircle(elem) { | ||
| expect(isUnknownElement(elem)).toBe(false); | ||
| @@ -300,17 +303,19 @@ describe('$compile', function() { | ||
| })); | ||
|
|
||
| // NOTE: This test may be redundant. | ||
| it('should handle custom svg containers that transclude to foreignObject' + | ||
| ' that transclude to custom svg containers that transclude to custom elements', inject(function() { | ||
| element = jqLite('<div><svg-container>' + | ||
| '<my-foreign-object><svg-container><svg-circle></svg-circle></svg-container></my-foreign-object>' + | ||
| '</svg-container></div>'); | ||
| $compile(element.contents())($rootScope); | ||
| document.body.appendChild(element[0]); | ||
|
|
||
| var circle = element.find('circle'); | ||
| assertIsValidSvgCircle(circle[0]); | ||
| })); | ||
| if (!isEdge) { | ||
| it('should handle custom svg containers that transclude to foreignObject' + | ||
| ' that transclude to custom svg containers that transclude to custom elements', inject(function() { | ||
| element = jqLite('<div><svg-container>' + | ||
| '<my-foreign-object><svg-container><svg-circle></svg-circle></svg-container></my-foreign-object>' + | ||
| '</svg-container></div>'); | ||
| $compile(element.contents())($rootScope); | ||
| document.body.appendChild(element[0]); | ||
|
|
||
| var circle = element.find('circle'); | ||
| assertIsValidSvgCircle(circle[0]); | ||
| })); | ||
| } | ||
| } | ||
|
|
||
| it('should handle directives with templates that manually add the transclude further down', inject(function() { | ||
| @@ -1196,7 +1196,7 @@ describe('input', function() { | ||
|
|
||
| it('should validate if max is empty', function() { | ||
| $rootScope.maxVal = undefined; | ||
| $rootScope.value = new Date(9999, 11, 31, 23, 59, 59); | ||
| $rootScope.value = new Date(3000, 11, 31, 23, 59, 59); | ||
| $rootScope.$digest(); | ||
|
|
||
| expect($rootScope.form.alias.$error.max).toBeFalsy(); | ||
| @@ -1491,11 +1491,11 @@ describe('ngRepeat animations', function() { | ||
| })); | ||
|
|
||
| it('should not change the position of the block that is being animated away via a leave animation', | ||
| inject(function($compile, $rootScope, $animate, $document, $window, $sniffer, $timeout) { | ||
| inject(function($compile, $rootScope, $animate, $document, $sniffer, $timeout) { | ||
| if (!$sniffer.transitions) return; | ||
|
|
||
| var item; | ||
| var ss = createMockStyleSheet($document, $window); | ||
| var ss = createMockStyleSheet($document); | ||
|
|
||
| try { | ||
|
|
||
| @@ -88,7 +88,9 @@ describe('$sniffer', function() { | ||
| inject(function($sniffer, $window) { | ||
| var expectedPrefix; | ||
| var ua = $window.navigator.userAgent.toLowerCase(); | ||
| if (/chrome/i.test(ua) || /safari/i.test(ua) || /webkit/i.test(ua)) { | ||
| if (/edge/i.test(ua)) { | ||
| expectedPrefix = 'Ms'; | ||
| } else if (/chrome/i.test(ua) || /safari/i.test(ua) || /webkit/i.test(ua)) { | ||
| expectedPrefix = 'Webkit'; | ||
| } else if (/firefox/i.test(ua)) { | ||
| expectedPrefix = 'Moz'; | ||
| @@ -69,11 +69,11 @@ describe("ngAnimate $$animateCssDriver", function() { | ||
|
|
||
| element = jqLite('<div></div>'); | ||
|
|
||
| return function($$animateCssDriver, $document, $window) { | ||
| return function($$animateCssDriver, $document) { | ||
| driver = function(details, cb) { | ||
| return $$animateCssDriver(details, cb || noop); | ||
| }; | ||
| ss = createMockStyleSheet($document, $window); | ||
| ss = createMockStyleSheet($document); | ||
| }; | ||
| })); | ||
|
|
||
Oops, something went wrong.