@@ -57,7 +57,7 @@ describe('FlexibleConnectedPositionStrategy', () => {
5757 }
5858
5959 it ( 'should throw when attempting to attach to multiple different overlays' , ( ) => {
60- const origin = new ElementRef ( document . createElement ( 'div' ) ) ;
60+ const origin = document . createElement ( 'div' ) ;
6161 const positionStrategy = overlay . position ( )
6262 . flexibleConnectedTo ( origin )
6363 . withPositions ( [ {
@@ -67,12 +67,16 @@ 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 ) ;
7072 attachOverlay ( { positionStrategy} ) ;
7173 expect ( ( ) => attachOverlay ( { positionStrategy} ) ) . toThrow ( ) ;
74+
75+ document . body . removeChild ( origin ) ;
7276 } ) ;
7377
7478 it ( 'should not throw when trying to apply after being disposed' , ( ) => {
75- const origin = new ElementRef ( document . createElement ( 'div' ) ) ;
79+ const origin = document . createElement ( 'div' ) ;
7680 const positionStrategy = overlay . position ( )
7781 . flexibleConnectedTo ( origin )
7882 . withPositions ( [ {
@@ -82,14 +86,18 @@ describe('FlexibleConnectedPositionStrategy', () => {
8286 originY : 'bottom'
8387 } ] ) ;
8488
89+ // Needs to be in the DOM for IE not to throw an "Unspecified error".
90+ document . body . appendChild ( origin ) ;
8591 attachOverlay ( { positionStrategy} ) ;
8692 overlayRef . dispose ( ) ;
8793
8894 expect ( ( ) => positionStrategy . apply ( ) ) . not . toThrow ( ) ;
95+
96+ document . body . removeChild ( origin ) ;
8997 } ) ;
9098
9199 it ( 'should not throw when trying to re-apply the last position after being disposed' , ( ) => {
92- const origin = new ElementRef ( document . createElement ( 'div' ) ) ;
100+ const origin = document . createElement ( 'div' ) ;
93101 const positionStrategy = overlay . position ( )
94102 . flexibleConnectedTo ( origin )
95103 . withPositions ( [ {
@@ -99,10 +107,14 @@ describe('FlexibleConnectedPositionStrategy', () => {
99107 originY : 'bottom'
100108 } ] ) ;
101109
110+ // Needs to be in the DOM for IE not to throw an "Unspecified error".
111+ document . body . appendChild ( origin ) ;
102112 attachOverlay ( { positionStrategy} ) ;
103113 overlayRef . dispose ( ) ;
104114
105115 expect ( ( ) => positionStrategy . reapplyLastPosition ( ) ) . not . toThrow ( ) ;
116+
117+ document . body . removeChild ( origin ) ;
106118 } ) ;
107119
108120 describe ( 'without flexible dimensions and pushing' , ( ) => {
@@ -119,7 +131,7 @@ describe('FlexibleConnectedPositionStrategy', () => {
119131 originElement = createPositionedBlockElement ( ) ;
120132 document . body . appendChild ( originElement ) ;
121133 positionStrategy = overlay . position ( )
122- . flexibleConnectedTo ( new ElementRef ( originElement ) )
134+ . flexibleConnectedTo ( originElement )
123135 . withFlexibleDimensions ( false )
124136 . withPush ( false ) ;
125137 } ) ;
@@ -863,7 +875,7 @@ describe('FlexibleConnectedPositionStrategy', () => {
863875 originElement = createPositionedBlockElement ( ) ;
864876 document . body . appendChild ( originElement ) ;
865877 positionStrategy = overlay . position ( )
866- . flexibleConnectedTo ( new ElementRef ( originElement ) )
878+ . flexibleConnectedTo ( originElement )
867879 . withFlexibleDimensions ( false )
868880 . withPush ( ) ;
869881 } ) ;
@@ -992,7 +1004,7 @@ describe('FlexibleConnectedPositionStrategy', () => {
9921004 beforeEach ( ( ) => {
9931005 originElement = createPositionedBlockElement ( ) ;
9941006 document . body . appendChild ( originElement ) ;
995- positionStrategy = overlay . position ( ) . flexibleConnectedTo ( new ElementRef ( originElement ) ) ;
1007+ positionStrategy = overlay . position ( ) . flexibleConnectedTo ( originElement ) ;
9961008 } ) ;
9971009
9981010 afterEach ( ( ) => {
@@ -1411,7 +1423,7 @@ describe('FlexibleConnectedPositionStrategy', () => {
14111423
14121424 // Create a strategy with knowledge of the scrollable container
14131425 const strategy = overlay . position ( )
1414- . flexibleConnectedTo ( new ElementRef ( originElement ) )
1426+ . flexibleConnectedTo ( originElement )
14151427 . withPush ( false )
14161428 . withPositions ( [ {
14171429 originX : 'start' ,
@@ -1490,7 +1502,7 @@ describe('FlexibleConnectedPositionStrategy', () => {
14901502 beforeEach ( ( ) => {
14911503 originElement = createPositionedBlockElement ( ) ;
14921504 document . body . appendChild ( originElement ) ;
1493- positionStrategy = overlay . position ( ) . flexibleConnectedTo ( new ElementRef ( originElement ) ) ;
1505+ positionStrategy = overlay . position ( ) . flexibleConnectedTo ( originElement ) ;
14941506 } ) ;
14951507
14961508 afterEach ( ( ) => {
@@ -1600,7 +1612,7 @@ describe('FlexibleConnectedPositionStrategy', () => {
16001612 beforeEach ( ( ) => {
16011613 originElement = createPositionedBlockElement ( ) ;
16021614 document . body . appendChild ( originElement ) ;
1603- positionStrategy = overlay . position ( ) . flexibleConnectedTo ( new ElementRef ( originElement ) ) ;
1615+ positionStrategy = overlay . position ( ) . flexibleConnectedTo ( originElement ) ;
16041616 } ) ;
16051617
16061618 afterEach ( ( ) => {
0 commit comments