Skip to content

Commit 9b2a4c6

Browse files
realitykinglgalfaso
authored andcommitted
test(IE8): remove workarounds for IE8
1 parent 2b4dfa9 commit 9b2a4c6

File tree

4 files changed

+26
-71
lines changed

4 files changed

+26
-71
lines changed

test/ng/compileSpec.js

Lines changed: 4 additions & 16 deletions
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)).toBe('<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)).toBe('<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)).toBe('<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)).toBe('<div><span class="i-hello">Hello, Elvis!</span></div>');
14011389
}
14021390
));
14031391

test/ng/directive/inputSpec.js

Lines changed: 14 additions & 36 deletions
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');
@@ -776,12 +772,8 @@ describe('input', function() {
776772

777773
expect(inputElm.val()).toBe('2013-W02');
778774

779-
try {
780-
//set to text for browsers with datetime-local validation.
781-
inputElm[0].setAttribute('type', 'text');
782-
} catch (e) {
783-
//for IE8
784-
}
775+
//set to text for browsers with datetime-local validation.
776+
inputElm[0].setAttribute('type', 'text');
785777

786778
helper.changeInputValueTo('stuff');
787779
expect(inputElm.val()).toBe('stuff');
@@ -965,12 +957,8 @@ describe('input', function() {
965957

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

968-
try {
969-
//set to text for browsers with datetime-local validation.
970-
inputElm[0].setAttribute('type', 'text');
971-
} catch (e) {
972-
//for IE8
973-
}
960+
//set to text for browsers with datetime-local validation.
961+
inputElm[0].setAttribute('type', 'text');
974962

975963
helper.changeInputValueTo('stuff');
976964
expect(inputElm.val()).toBe('stuff');
@@ -1277,12 +1265,8 @@ describe('input', function() {
12771265

12781266
expect(inputElm.val()).toBe('16:25:00.000');
12791267

1280-
try {
1281-
//set to text for browsers with time validation.
1282-
inputElm[0].setAttribute('type', 'text');
1283-
} catch (e) {
1284-
//for IE8
1285-
}
1268+
//set to text for browsers with time validation.
1269+
inputElm[0].setAttribute('type', 'text');
12861270

12871271
helper.changeInputValueTo('stuff');
12881272
expect(inputElm.val()).toBe('stuff');
@@ -1571,12 +1555,8 @@ describe('input', function() {
15711555

15721556
expect(inputElm.val()).toBe('2014-09-14');
15731557

1574-
try {
1575-
//set to text for browsers with date validation.
1576-
inputElm[0].setAttribute('type', 'text');
1577-
} catch (e) {
1578-
//for IE8
1579-
}
1558+
//set to text for browsers with date validation.
1559+
inputElm[0].setAttribute('type', 'text');
15801560

15811561
helper.changeInputValueTo('1-2-3');
15821562
expect(inputElm.val()).toBe('1-2-3');
@@ -1843,12 +1823,10 @@ describe('input', function() {
18431823
$rootScope.$apply('age = 123');
18441824
expect(inputElm.val()).toBe('123');
18451825

1846-
try {
1847-
// to allow non-number values, we have to change type so that
1848-
// the browser which have number validation will not interfere with
1849-
// this test. IE8 won't allow it hence the catch.
1850-
inputElm[0].setAttribute('type', 'text');
1851-
} catch (e) {}
1826+
// to allow non-number values, we have to change type so that
1827+
// the browser which have number validation will not interfere with
1828+
// this test.
1829+
inputElm[0].setAttribute('type', 'text');
18521830

18531831
helper.changeInputValueTo('123X');
18541832
expect(inputElm.val()).toBe('123X');

test/ng/directive/ngIncludeSpec.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,7 @@ describe('ngInclude', function() {
354354

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

357-
// IE8 doesn't like deleting properties of window
358-
window._ngIncludeCausesScriptToRun = undefined;
359-
try {
360-
delete window._ngIncludeCausesScriptToRun;
361-
} catch (e) {}
357+
delete window._ngIncludeCausesScriptToRun;
362358
}));
363359

364360

test/ng/directive/styleSpec.js

Lines changed: 7 additions & 14 deletions
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

0 commit comments

Comments
 (0)