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

Commit edf7d27

Browse files
committed
test(IE8) Remove special code for IE8
1 parent a2adfae commit edf7d27

File tree

7 files changed

+26
-82
lines changed

7 files changed

+26
-82
lines changed

test/ng/compileSpec.js

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

13281328

1329-
expect(sortedHtml(element)).toBeOneOf(
1330-
'<div><b class="i-hello"></b><span class="i-cau">Cau!</span></div>',
1331-
'<div><b class="i-hello"></b><span class="i-cau" i-cau="">Cau!</span></div>' //ie8
1332-
);
1329+
expect(sortedHtml(element)).toEqual('<div><b class="i-hello"></b><span class="i-cau">Cau!</span></div>');
13331330

13341331
$httpBackend.flush();
1335-
expect(sortedHtml(element)).toBeOneOf(
1336-
'<div><span class="i-hello">Hello!</span><span class="i-cau">Cau!</span></div>',
1337-
'<div><span class="i-hello" i-hello="">Hello!</span><span class="i-cau" i-cau="">Cau!</span></div>' //ie8
1338-
);
1332+
expect(sortedHtml(element)).toEqual('<div><span class="i-hello">Hello!</span><span class="i-cau">Cau!</span></div>');
13391333
}
13401334
));
13411335

@@ -1362,10 +1356,7 @@ describe('$compile', function() {
13621356

13631357
$rootScope.$digest();
13641358

1365-
expect(sortedHtml(element)).toBeOneOf(
1366-
'<div><span class="i-hello">Hello, Elvis!</span></div>',
1367-
'<div><span class="i-hello" i-hello="">Hello, Elvis!</span></div>' //ie8
1368-
);
1359+
expect(sortedHtml(element)).toEqual('<div><span class="i-hello">Hello, Elvis!</span></div>');
13691360
}
13701361
));
13711362

@@ -1394,10 +1385,7 @@ describe('$compile', function() {
13941385
element = template($rootScope);
13951386
$rootScope.$digest();
13961387

1397-
expect(sortedHtml(element)).toBeOneOf(
1398-
'<div><span class="i-hello">Hello, Elvis!</span></div>',
1399-
'<div><span class="i-hello" i-hello="">Hello, Elvis!</span></div>' //ie8
1400-
);
1388+
expect(sortedHtml(element)).toEqual('<div><span class="i-hello">Hello, Elvis!</span></div>');
14011389
}
14021390
));
14031391

test/ng/directive/inputSpec.js

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

552552
expect(inputElm.val()).toBe('2013-01');
553553

554-
try {
555-
//set to text for browsers with datetime-local validation.
556-
inputElm[0].setAttribute('type', 'text');
557-
} catch (e) {
558-
//for IE8
559-
}
554+
//set to text for browsers with datetime-local validation.
555+
inputElm[0].setAttribute('type', 'text');
560556

561557
helper.changeInputValueTo('stuff');
562558
expect(inputElm.val()).toBe('stuff');
@@ -752,12 +748,8 @@ describe('input', function() {
752748

753749
expect(inputElm.val()).toBe('2013-W02');
754750

755-
try {
756-
//set to text for browsers with datetime-local validation.
757-
inputElm[0].setAttribute('type', 'text');
758-
} catch (e) {
759-
//for IE8
760-
}
751+
//set to text for browsers with datetime-local validation.
752+
inputElm[0].setAttribute('type', 'text');
761753

762754
helper.changeInputValueTo('stuff');
763755
expect(inputElm.val()).toBe('stuff');
@@ -928,12 +920,8 @@ describe('input', function() {
928920

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

931-
try {
932-
//set to text for browsers with datetime-local validation.
933-
inputElm[0].setAttribute('type', 'text');
934-
} catch (e) {
935-
//for IE8
936-
}
923+
//set to text for browsers with datetime-local validation.
924+
inputElm[0].setAttribute('type', 'text');
937925

938926
helper.changeInputValueTo('stuff');
939927
expect(inputElm.val()).toBe('stuff');
@@ -1216,12 +1204,8 @@ describe('input', function() {
12161204

12171205
expect(inputElm.val()).toBe('16:25:00.000');
12181206

1219-
try {
1220-
//set to text for browsers with time validation.
1221-
inputElm[0].setAttribute('type', 'text');
1222-
} catch (e) {
1223-
//for IE8
1224-
}
1207+
//set to text for browsers with time validation.
1208+
inputElm[0].setAttribute('type', 'text');
12251209

12261210
helper.changeInputValueTo('stuff');
12271211
expect(inputElm.val()).toBe('stuff');
@@ -1497,12 +1481,8 @@ describe('input', function() {
14971481

14981482
expect(inputElm.val()).toBe('2014-09-14');
14991483

1500-
try {
1501-
//set to text for browsers with date validation.
1502-
inputElm[0].setAttribute('type', 'text');
1503-
} catch (e) {
1504-
//for IE8
1505-
}
1484+
//set to text for browsers with date validation.
1485+
inputElm[0].setAttribute('type', 'text');
15061486

15071487
helper.changeInputValueTo('1-2-3');
15081488
expect(inputElm.val()).toBe('1-2-3');
@@ -1756,12 +1736,10 @@ describe('input', function() {
17561736
$rootScope.$apply('age = 123');
17571737
expect(inputElm.val()).toBe('123');
17581738

1759-
try {
1760-
// to allow non-number values, we have to change type so that
1761-
// the browser which have number validation will not interfere with
1762-
// this test. IE8 won't allow it hence the catch.
1763-
inputElm[0].setAttribute('type', 'text');
1764-
} catch (e) {}
1739+
// to allow non-number values, we have to change type so that
1740+
// the browser which have number validation will not interfere with
1741+
// this test.
1742+
inputElm[0].setAttribute('type', 'text');
17651743

17661744
helper.changeInputValueTo('123X');
17671745
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
@@ -235,7 +235,7 @@ describe('$httpBackend', function() {
235235

236236

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

240240
$backend('GET', '/whatever', null, callback, {}, null, null, 'blob');
241241

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
@@ -719,8 +719,6 @@ describe('ngMock', function() {
719719

720720
it('should serialize scope that has overridden "hasOwnProperty"', inject(function($rootScope, $sniffer) {
721721
/* jshint -W001 */
722-
// MS IE8 just doesn't work for this kind of thing, since "for ... in" doesn't return
723-
// things like hasOwnProperty even if it is explicitly defined on the actual object!
724722
$rootScope.hasOwnProperty = 'X';
725723
expect(d($rootScope)).toMatch(/Scope\(.*\): \{/);
726724
expect(d($rootScope)).toMatch(/hasOwnProperty: "X"/);
@@ -905,11 +903,6 @@ describe('ngMock', function() {
905903
});
906904
});
907905

908-
909-
// We don't run the following tests on IE8.
910-
// IE8 throws "Object does not support this property or method." error,
911-
// when thrown from a function defined on window (which `inject` is).
912-
913906
it('should not change thrown Errors', inject(function($sniffer) {
914907
expect(function() {
915908
inject(function() {

0 commit comments

Comments
 (0)