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

Commit b6bab30

Browse files
committed
test(IE8) Remove special code for IE8
1 parent 2492866 commit b6bab30

8 files changed

+27
-83
lines changed

test/ng/compileSpec.js

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

13001300

1301-
expect(sortedHtml(element)).toBeOneOf(
1302-
'<div><b class="i-hello"></b><span class="i-cau">Cau!</span></div>',
1303-
'<div><b class="i-hello"></b><span class="i-cau" i-cau="">Cau!</span></div>' //ie8
1304-
);
1301+
expect(sortedHtml(element)).toEqual('<div><b class="i-hello"></b><span class="i-cau">Cau!</span></div>');
13051302

13061303
$httpBackend.flush();
1307-
expect(sortedHtml(element)).toBeOneOf(
1308-
'<div><span class="i-hello">Hello!</span><span class="i-cau">Cau!</span></div>',
1309-
'<div><span class="i-hello" i-hello="">Hello!</span><span class="i-cau" i-cau="">Cau!</span></div>' //ie8
1310-
);
1304+
expect(sortedHtml(element)).toEqual('<div><span class="i-hello">Hello!</span><span class="i-cau">Cau!</span></div>');
13111305
}
13121306
));
13131307

@@ -1334,10 +1328,7 @@ describe('$compile', function() {
13341328

13351329
$rootScope.$digest();
13361330

1337-
expect(sortedHtml(element)).toBeOneOf(
1338-
'<div><span class="i-hello">Hello, Elvis!</span></div>',
1339-
'<div><span class="i-hello" i-hello="">Hello, Elvis!</span></div>' //ie8
1340-
);
1331+
expect(sortedHtml(element)).toEqual('<div><span class="i-hello">Hello, Elvis!</span></div>');
13411332
}
13421333
));
13431334

@@ -1366,10 +1357,7 @@ describe('$compile', function() {
13661357
element = template($rootScope);
13671358
$rootScope.$digest();
13681359

1369-
expect(sortedHtml(element)).toBeOneOf(
1370-
'<div><span class="i-hello">Hello, Elvis!</span></div>',
1371-
'<div><span class="i-hello" i-hello="">Hello, Elvis!</span></div>' //ie8
1372-
);
1360+
expect(sortedHtml(element)).toEqual('<div><span class="i-hello">Hello, Elvis!</span></div>');
13731361
}
13741362
));
13751363

test/ng/directive/inputSpec.js

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

23982398
expect(inputElm.val()).toBe('2013-01');
23992399

2400-
try {
2401-
//set to text for browsers with datetime-local validation.
2402-
inputElm[0].setAttribute('type', 'text');
2403-
} catch (e) {
2404-
//for IE8
2405-
}
2400+
//set to text for browsers with datetime-local validation.
2401+
inputElm[0].setAttribute('type', 'text');
24062402

24072403
changeInputValueTo('stuff');
24082404
expect(inputElm.val()).toBe('stuff');
@@ -2591,12 +2587,8 @@ describe('input', function() {
25912587

25922588
expect(inputElm.val()).toBe('2013-W02');
25932589

2594-
try {
2595-
//set to text for browsers with datetime-local validation.
2596-
inputElm[0].setAttribute('type', 'text');
2597-
} catch (e) {
2598-
//for IE8
2599-
}
2590+
//set to text for browsers with datetime-local validation.
2591+
inputElm[0].setAttribute('type', 'text');
26002592

26012593
changeInputValueTo('stuff');
26022594
expect(inputElm.val()).toBe('stuff');
@@ -2760,12 +2752,8 @@ describe('input', function() {
27602752

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

2763-
try {
2764-
//set to text for browsers with datetime-local validation.
2765-
inputElm[0].setAttribute('type', 'text');
2766-
} catch (e) {
2767-
//for IE8
2768-
}
2755+
//set to text for browsers with datetime-local validation.
2756+
inputElm[0].setAttribute('type', 'text');
27692757

27702758
changeInputValueTo('stuff');
27712759
expect(inputElm.val()).toBe('stuff');
@@ -3035,12 +3023,8 @@ describe('input', function() {
30353023

30363024
expect(inputElm.val()).toBe('16:25:00.000');
30373025

3038-
try {
3039-
//set to text for browsers with time validation.
3040-
inputElm[0].setAttribute('type', 'text');
3041-
} catch (e) {
3042-
//for IE8
3043-
}
3026+
//set to text for browsers with time validation.
3027+
inputElm[0].setAttribute('type', 'text');
30443028

30453029
changeInputValueTo('stuff');
30463030
expect(inputElm.val()).toBe('stuff');
@@ -3299,12 +3283,8 @@ describe('input', function() {
32993283

33003284
expect(inputElm.val()).toBe('2014-09-14');
33013285

3302-
try {
3303-
//set to text for browsers with date validation.
3304-
inputElm[0].setAttribute('type', 'text');
3305-
} catch (e) {
3306-
//for IE8
3307-
}
3286+
//set to text for browsers with date validation.
3287+
inputElm[0].setAttribute('type', 'text');
33083288

33093289
changeInputValueTo('1-2-3');
33103290
expect(inputElm.val()).toBe('1-2-3');
@@ -3567,12 +3547,10 @@ describe('input', function() {
35673547
scope.$apply('age = 123');
35683548
expect(inputElm.val()).toBe('123');
35693549

3570-
try {
3571-
// to allow non-number values, we have to change type so that
3572-
// the browser which have number validation will not interfere with
3573-
// this test. IE8 won't allow it hence the catch.
3574-
inputElm[0].setAttribute('type', 'text');
3575-
} catch (e) {}
3550+
// to allow non-number values, we have to change type so that
3551+
// the browser which have number validation will not interfere with
3552+
// this test.
3553+
inputElm[0].setAttribute('type', 'text');
35763554

35773555
changeInputValueTo('123X');
35783556
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)