Skip to content

Commit c224a38

Browse files
crisbetojelbourn
authored andcommitted
build: fix tests crashing IE test runs (#11287)
This is another step towards re-enabling test runs against IE11. Fixes the tests that outright crashed the test run due to an "Unspecified error". The error was being thrown, because we were attempting to get the client rect of an element that wasn't in the DOM. These changes also fix a handful of tests that were leaking DOM elements. We should now be able to do an uninterrupted test run on IE, although there are still a handful of failing tests that might require code changes.
1 parent f13713e commit c224a38

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/cdk/overlay/position/flexible-connected-position-strategy.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,13 @@ describe('FlexibleConnectedPositionStrategy', () => {
6767
originY: 'bottom'
6868
}]);
6969

70+
// Needs to be in the DOM for IE not to throw an "Unspecified error".
71+
document.body.appendChild(origin.nativeElement);
7072
attachOverlay({positionStrategy});
73+
7174
expect(() => attachOverlay({positionStrategy})).toThrow();
75+
76+
document.body.removeChild(origin.nativeElement);
7277
});
7378

7479
it('should not throw when trying to apply after being disposed', () => {
@@ -82,10 +87,14 @@ describe('FlexibleConnectedPositionStrategy', () => {
8287
originY: 'bottom'
8388
}]);
8489

90+
// Needs to be in the DOM for IE not to throw an "Unspecified error".
91+
document.body.appendChild(origin.nativeElement);
8592
attachOverlay({positionStrategy});
8693
overlayRef.dispose();
8794

8895
expect(() => positionStrategy.apply()).not.toThrow();
96+
97+
document.body.removeChild(origin.nativeElement);
8998
});
9099

91100
it('should not throw when trying to re-apply the last position after being disposed', () => {
@@ -99,10 +108,14 @@ describe('FlexibleConnectedPositionStrategy', () => {
99108
originY: 'bottom'
100109
}]);
101110

111+
// Needs to be in the DOM for IE not to throw an "Unspecified error".
112+
document.body.appendChild(origin.nativeElement);
102113
attachOverlay({positionStrategy});
103114
overlayRef.dispose();
104115

105116
expect(() => positionStrategy.reapplyLastPosition()).not.toThrow();
117+
118+
document.body.removeChild(origin.nativeElement);
106119
});
107120

108121
describe('without flexible dimensions and pushing', () => {
@@ -1712,6 +1725,7 @@ describe('FlexibleConnectedPositionStrategy', () => {
17121725
});
17131726

17141727
afterEach(() => {
1728+
document.body.removeChild(originElement);
17151729
positionStrategy.dispose();
17161730
});
17171731

0 commit comments

Comments
 (0)