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

Commit 2bfbfd6

Browse files
committed
test(IE8) Remove special code for IE8
1 parent ab62c12 commit 2bfbfd6

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
@@ -2379,12 +2379,8 @@ describe('input', function() {
23792379

23802380
expect(inputElm.val()).toBe('2013-01');
23812381

2382-
try {
2383-
//set to text for browsers with datetime-local validation.
2384-
inputElm[0].setAttribute('type', 'text');
2385-
} catch(e) {
2386-
//for IE8
2387-
}
2382+
//set to text for browsers with datetime-local validation.
2383+
inputElm[0].setAttribute('type', 'text');
23882384

23892385
changeInputValueTo('stuff');
23902386
expect(inputElm.val()).toBe('stuff');
@@ -2573,12 +2569,8 @@ describe('input', function() {
25732569

25742570
expect(inputElm.val()).toBe('2013-W02');
25752571

2576-
try {
2577-
//set to text for browsers with datetime-local validation.
2578-
inputElm[0].setAttribute('type', 'text');
2579-
} catch(e) {
2580-
//for IE8
2581-
}
2572+
//set to text for browsers with datetime-local validation.
2573+
inputElm[0].setAttribute('type', 'text');
25822574

25832575
changeInputValueTo('stuff');
25842576
expect(inputElm.val()).toBe('stuff');
@@ -2742,12 +2734,8 @@ describe('input', function() {
27422734

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

2745-
try {
2746-
//set to text for browsers with datetime-local validation.
2747-
inputElm[0].setAttribute('type', 'text');
2748-
} catch(e) {
2749-
//for IE8
2750-
}
2737+
//set to text for browsers with datetime-local validation.
2738+
inputElm[0].setAttribute('type', 'text');
27512739

27522740
changeInputValueTo('stuff');
27532741
expect(inputElm.val()).toBe('stuff');
@@ -3017,12 +3005,8 @@ describe('input', function() {
30173005

30183006
expect(inputElm.val()).toBe('16:25:00.000');
30193007

3020-
try {
3021-
//set to text for browsers with time validation.
3022-
inputElm[0].setAttribute('type', 'text');
3023-
} catch(e) {
3024-
//for IE8
3025-
}
3008+
//set to text for browsers with time validation.
3009+
inputElm[0].setAttribute('type', 'text');
30263010

30273011
changeInputValueTo('stuff');
30283012
expect(inputElm.val()).toBe('stuff');
@@ -3281,12 +3265,8 @@ describe('input', function() {
32813265

32823266
expect(inputElm.val()).toBe('2014-09-14');
32833267

3284-
try {
3285-
//set to text for browsers with date validation.
3286-
inputElm[0].setAttribute('type', 'text');
3287-
} catch(e) {
3288-
//for IE8
3289-
}
3268+
//set to text for browsers with date validation.
3269+
inputElm[0].setAttribute('type', 'text');
32903270

32913271
changeInputValueTo('1-2-3');
32923272
expect(inputElm.val()).toBe('1-2-3');
@@ -3549,12 +3529,10 @@ describe('input', function() {
35493529
scope.$apply('age = 123');
35503530
expect(inputElm.val()).toBe('123');
35513531

3552-
try {
3553-
// to allow non-number values, we have to change type so that
3554-
// the browser which have number validation will not interfere with
3555-
// this test. IE8 won't allow it hence the catch.
3556-
inputElm[0].setAttribute('type', 'text');
3557-
} catch (e) {}
3532+
// to allow non-number values, we have to change type so that
3533+
// the browser which have number validation will not interfere with
3534+
// this test.
3535+
inputElm[0].setAttribute('type', 'text');
35583536

35593537
changeInputValueTo('123X');
35603538
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)