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

Commit 2f55e3b

Browse files
committed
test(IE8) Remove special code for IE8
1 parent ff79453 commit 2f55e3b

8 files changed

+27
-83
lines changed

test/ng/compileSpec.js

+4-16
Original file line numberDiff line numberDiff line change
@@ -1287,16 +1287,10 @@ describe('$compile', function() {
12871287
$rootScope.$digest();
12881288

12891289

1290-
expect(sortedHtml(element)).toBeOneOf(
1291-
'<div><b class="i-hello"></b><span class="i-cau">Cau!</span></div>',
1292-
'<div><b class="i-hello"></b><span class="i-cau" i-cau="">Cau!</span></div>' //ie8
1293-
);
1290+
expect(sortedHtml(element)).toEqual('<div><b class="i-hello"></b><span class="i-cau">Cau!</span></div>');
12941291

12951292
$httpBackend.flush();
1296-
expect(sortedHtml(element)).toBeOneOf(
1297-
'<div><span class="i-hello">Hello!</span><span class="i-cau">Cau!</span></div>',
1298-
'<div><span class="i-hello" i-hello="">Hello!</span><span class="i-cau" i-cau="">Cau!</span></div>' //ie8
1299-
);
1293+
expect(sortedHtml(element)).toEqual('<div><span class="i-hello">Hello!</span><span class="i-cau">Cau!</span></div>');
13001294
}
13011295
));
13021296

@@ -1323,10 +1317,7 @@ describe('$compile', function() {
13231317

13241318
$rootScope.$digest();
13251319

1326-
expect(sortedHtml(element)).toBeOneOf(
1327-
'<div><span class="i-hello">Hello, Elvis!</span></div>',
1328-
'<div><span class="i-hello" i-hello="">Hello, Elvis!</span></div>' //ie8
1329-
);
1320+
expect(sortedHtml(element)).toEqual('<div><span class="i-hello">Hello, Elvis!</span></div>');
13301321
}
13311322
));
13321323

@@ -1355,10 +1346,7 @@ describe('$compile', function() {
13551346
element = template($rootScope);
13561347
$rootScope.$digest();
13571348

1358-
expect(sortedHtml(element)).toBeOneOf(
1359-
'<div><span class="i-hello">Hello, Elvis!</span></div>',
1360-
'<div><span class="i-hello" i-hello="">Hello, Elvis!</span></div>' //ie8
1361-
);
1349+
expect(sortedHtml(element)).toEqual('<div><span class="i-hello">Hello, Elvis!</span></div>');
13621350
}
13631351
));
13641352

test/ng/directive/inputSpec.js

+14-36
Original file line numberDiff line numberDiff line change
@@ -2340,12 +2340,8 @@ describe('input', function() {
23402340

23412341
expect(inputElm.val()).toBe('2013-01');
23422342

2343-
try {
2344-
//set to text for browsers with datetime-local validation.
2345-
inputElm[0].setAttribute('type', 'text');
2346-
} catch(e) {
2347-
//for IE8
2348-
}
2343+
//set to text for browsers with datetime-local validation.
2344+
inputElm[0].setAttribute('type', 'text');
23492345

23502346
changeInputValueTo('stuff');
23512347
expect(inputElm.val()).toBe('stuff');
@@ -2534,12 +2530,8 @@ describe('input', function() {
25342530

25352531
expect(inputElm.val()).toBe('2013-W02');
25362532

2537-
try {
2538-
//set to text for browsers with datetime-local validation.
2539-
inputElm[0].setAttribute('type', 'text');
2540-
} catch(e) {
2541-
//for IE8
2542-
}
2533+
//set to text for browsers with datetime-local validation.
2534+
inputElm[0].setAttribute('type', 'text');
25432535

25442536
changeInputValueTo('stuff');
25452537
expect(inputElm.val()).toBe('stuff');
@@ -2703,12 +2695,8 @@ describe('input', function() {
27032695

27042696
expect(inputElm.val()).toBe('2009-01-06T16:25:00.000');
27052697

2706-
try {
2707-
//set to text for browsers with datetime-local validation.
2708-
inputElm[0].setAttribute('type', 'text');
2709-
} catch(e) {
2710-
//for IE8
2711-
}
2698+
//set to text for browsers with datetime-local validation.
2699+
inputElm[0].setAttribute('type', 'text');
27122700

27132701
changeInputValueTo('stuff');
27142702
expect(inputElm.val()).toBe('stuff');
@@ -2978,12 +2966,8 @@ describe('input', function() {
29782966

29792967
expect(inputElm.val()).toBe('16:25:00.000');
29802968

2981-
try {
2982-
//set to text for browsers with time validation.
2983-
inputElm[0].setAttribute('type', 'text');
2984-
} catch(e) {
2985-
//for IE8
2986-
}
2969+
//set to text for browsers with time validation.
2970+
inputElm[0].setAttribute('type', 'text');
29872971

29882972
changeInputValueTo('stuff');
29892973
expect(inputElm.val()).toBe('stuff');
@@ -3242,12 +3226,8 @@ describe('input', function() {
32423226

32433227
expect(inputElm.val()).toBe('2014-09-14');
32443228

3245-
try {
3246-
//set to text for browsers with date validation.
3247-
inputElm[0].setAttribute('type', 'text');
3248-
} catch(e) {
3249-
//for IE8
3250-
}
3229+
//set to text for browsers with date validation.
3230+
inputElm[0].setAttribute('type', 'text');
32513231

32523232
changeInputValueTo('1-2-3');
32533233
expect(inputElm.val()).toBe('1-2-3');
@@ -3510,12 +3490,10 @@ describe('input', function() {
35103490
scope.$apply('age = 123');
35113491
expect(inputElm.val()).toBe('123');
35123492

3513-
try {
3514-
// to allow non-number values, we have to change type so that
3515-
// the browser which have number validation will not interfere with
3516-
// this test. IE8 won't allow it hence the catch.
3517-
inputElm[0].setAttribute('type', 'text');
3518-
} catch (e) {}
3493+
// to allow non-number values, we have to change type so that
3494+
// the browser which have number validation will not interfere with
3495+
// this test.
3496+
inputElm[0].setAttribute('type', 'text');
35193497

35203498
changeInputValueTo('123X');
35213499
expect(inputElm.val()).toBe('123X');

test/ng/directive/ngIncludeSpec.js

-2
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,6 @@ describe('ngInclude', function() {
354354

355355
expect(window._ngIncludeCausesScriptToRun).toBe(true);
356356

357-
// IE8 doesn't like deleting properties of window
358-
window._ngIncludeCausesScriptToRun = undefined;
359357
try {
360358
delete window._ngIncludeCausesScriptToRun;
361359
} catch (e) {}

test/ng/directive/styleSpec.js

+7-14
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ describe('style', function() {
1414
$compile(element)($rootScope);
1515
$rootScope.$digest();
1616

17-
// read innerHTML and trim to pass on IE8
18-
expect(trim(element[0].innerHTML)).toBe('.header{font-size:1.5em; h3{font-size:1.5em}}');
17+
expect(element[0].innerHTML).toBe('.header{font-size:1.5em; h3{font-size:1.5em}}');
1918
}));
2019

2120

@@ -24,15 +23,13 @@ describe('style', function() {
2423
$compile(element)($rootScope);
2524
$rootScope.$digest();
2625

27-
// read innerHTML and trim to pass on IE8
28-
expect(trim(element[0].innerHTML)).toBe('.some-container{ width: px; }');
26+
expect(element[0].innerHTML).toBe('.some-container{ width: px; }');
2927

3028
$rootScope.$apply(function() {
3129
$rootScope.elementWidth = 200;
3230
});
3331

34-
// read innerHTML and trim to pass on IE8
35-
expect(trim(element[0].innerHTML)).toBe('.some-container{ width: 200px; }');
32+
expect(element[0].innerHTML).toBe('.some-container{ width: 200px; }');
3633
}));
3734

3835

@@ -41,15 +38,13 @@ describe('style', function() {
4138
$compile(element)($rootScope);
4239
$rootScope.$digest();
4340

44-
// read innerHTML and trim to pass on IE8
45-
expect(trim(element[0].innerHTML)).toBe('.header{ h3 { font-size: em }}');
41+
expect(element[0].innerHTML).toBe('.header{ h3 { font-size: em }}');
4642

4743
$rootScope.$apply(function() {
4844
$rootScope.fontSize = 1.5;
4945
});
5046

51-
// read innerHTML and trim to pass on IE8
52-
expect(trim(element[0].innerHTML)).toBe('.header{ h3 { font-size: 1.5em }}');
47+
expect(element[0].innerHTML).toBe('.header{ h3 { font-size: 1.5em }}');
5348
}));
5449

5550

@@ -58,16 +53,14 @@ describe('style', function() {
5853
$compile(element)($rootScope);
5954
$rootScope.$digest();
6055

61-
// read innerHTML and trim to pass on IE8
62-
expect(trim(element[0].innerHTML)).toBe('.header{ h3 { font-size: }}');
56+
expect(element[0].innerHTML).toBe('.header{ h3 { font-size: }}');
6357

6458
$rootScope.$apply(function() {
6559
$rootScope.fontSize = 1.5;
6660
$rootScope.unit = 'em';
6761
});
6862

69-
// read innerHTML and trim to pass on IE8
70-
expect(trim(element[0].innerHTML)).toBe('.header{ h3 { font-size: 1.5em }}');
63+
expect(element[0].innerHTML).toBe('.header{ h3 { font-size: 1.5em }}');
7164
}));
7265

7366

test/ng/httpBackendSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ describe('$httpBackend', function() {
264264

265265

266266
it('should read responseText if response was not defined', function() {
267-
// old browsers like IE8, don't support responseType, so they always respond with responseText
267+
// old browsers like IE9, don't support responseType, so they always respond with responseText
268268

269269
$backend('GET', '/whatever', null, callback, {}, null, null, 'blob');
270270

test/ng/rootScopeSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('Scope', function() {
1414

1515
it('should expose the constructor', inject(function($rootScope) {
1616
/* jshint -W103 */
17-
if (msie) return;
17+
if (msie < 11) return;
1818
expect($rootScope.__proto__).toBe($rootScope.constructor.prototype);
1919
}));
2020

test/ng/sceSpecs.js

-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22

33
describe('SCE', function() {
44

5-
// Work around an IE8 bug. Though window.inject === angular.mock.inject, if it's invoked the
6-
// window scope, IE8 loses the exception object that bubbles up and replaces it with a TypeError.
7-
// By using a local alias, it gets invoked on the global scope instead of window.
8-
// Ref: https://github.com/angular/angular.js/pull/4221#/issuecomment-25515813
9-
var inject = angular.mock.inject;
10-
115
describe('when disabled', function() {
126
beforeEach(function() {
137
module(function($sceProvider) {

test/ngMock/angular-mocksSpec.js

-7
Original file line numberDiff line numberDiff line change
@@ -695,8 +695,6 @@ describe('ngMock', function() {
695695

696696
it('should serialize scope that has overridden "hasOwnProperty"', inject(function($rootScope, $sniffer){
697697
/* jshint -W001 */
698-
// MS IE8 just doesn't work for this kind of thing, since "for ... in" doesn't return
699-
// things like hasOwnProperty even if it is explicitly defined on the actual object!
700698
$rootScope.hasOwnProperty = 'X';
701699
expect(d($rootScope)).toMatch(/Scope\(.*\): \{/);
702700
expect(d($rootScope)).toMatch(/hasOwnProperty: "X"/);
@@ -848,11 +846,6 @@ describe('ngMock', function() {
848846
});
849847
});
850848

851-
852-
// We don't run the following tests on IE8.
853-
// IE8 throws "Object does not support this property or method." error,
854-
// when thrown from a function defined on window (which `inject` is).
855-
856849
it('should not change thrown Errors', inject(function($sniffer) {
857850
expect(function() {
858851
inject(function() {

0 commit comments

Comments
 (0)