@@ -57,7 +57,7 @@ describe('FlexibleConnectedPositionStrategy', () => {
57
57
}
58
58
59
59
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' ) ;
61
61
const positionStrategy = overlay . position ( )
62
62
. flexibleConnectedTo ( origin )
63
63
. withPositions ( [ {
@@ -67,12 +67,16 @@ describe('FlexibleConnectedPositionStrategy', () => {
67
67
originY : 'bottom'
68
68
} ] ) ;
69
69
70
+ // Needs to be in the DOM for IE not to throw an "Unspecified error".
71
+ document . body . appendChild ( origin ) ;
70
72
attachOverlay ( { positionStrategy} ) ;
71
73
expect ( ( ) => attachOverlay ( { positionStrategy} ) ) . toThrow ( ) ;
74
+
75
+ document . body . removeChild ( origin ) ;
72
76
} ) ;
73
77
74
78
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' ) ;
76
80
const positionStrategy = overlay . position ( )
77
81
. flexibleConnectedTo ( origin )
78
82
. withPositions ( [ {
@@ -82,14 +86,18 @@ describe('FlexibleConnectedPositionStrategy', () => {
82
86
originY : 'bottom'
83
87
} ] ) ;
84
88
89
+ // Needs to be in the DOM for IE not to throw an "Unspecified error".
90
+ document . body . appendChild ( origin ) ;
85
91
attachOverlay ( { positionStrategy} ) ;
86
92
overlayRef . dispose ( ) ;
87
93
88
94
expect ( ( ) => positionStrategy . apply ( ) ) . not . toThrow ( ) ;
95
+
96
+ document . body . removeChild ( origin ) ;
89
97
} ) ;
90
98
91
99
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' ) ;
93
101
const positionStrategy = overlay . position ( )
94
102
. flexibleConnectedTo ( origin )
95
103
. withPositions ( [ {
@@ -99,10 +107,14 @@ describe('FlexibleConnectedPositionStrategy', () => {
99
107
originY : 'bottom'
100
108
} ] ) ;
101
109
110
+ // Needs to be in the DOM for IE not to throw an "Unspecified error".
111
+ document . body . appendChild ( origin ) ;
102
112
attachOverlay ( { positionStrategy} ) ;
103
113
overlayRef . dispose ( ) ;
104
114
105
115
expect ( ( ) => positionStrategy . reapplyLastPosition ( ) ) . not . toThrow ( ) ;
116
+
117
+ document . body . removeChild ( origin ) ;
106
118
} ) ;
107
119
108
120
describe ( 'without flexible dimensions and pushing' , ( ) => {
@@ -119,7 +131,7 @@ describe('FlexibleConnectedPositionStrategy', () => {
119
131
originElement = createPositionedBlockElement ( ) ;
120
132
document . body . appendChild ( originElement ) ;
121
133
positionStrategy = overlay . position ( )
122
- . flexibleConnectedTo ( new ElementRef ( originElement ) )
134
+ . flexibleConnectedTo ( originElement )
123
135
. withFlexibleDimensions ( false )
124
136
. withPush ( false ) ;
125
137
} ) ;
@@ -863,7 +875,7 @@ describe('FlexibleConnectedPositionStrategy', () => {
863
875
originElement = createPositionedBlockElement ( ) ;
864
876
document . body . appendChild ( originElement ) ;
865
877
positionStrategy = overlay . position ( )
866
- . flexibleConnectedTo ( new ElementRef ( originElement ) )
878
+ . flexibleConnectedTo ( originElement )
867
879
. withFlexibleDimensions ( false )
868
880
. withPush ( ) ;
869
881
} ) ;
@@ -992,7 +1004,7 @@ describe('FlexibleConnectedPositionStrategy', () => {
992
1004
beforeEach ( ( ) => {
993
1005
originElement = createPositionedBlockElement ( ) ;
994
1006
document . body . appendChild ( originElement ) ;
995
- positionStrategy = overlay . position ( ) . flexibleConnectedTo ( new ElementRef ( originElement ) ) ;
1007
+ positionStrategy = overlay . position ( ) . flexibleConnectedTo ( originElement ) ;
996
1008
} ) ;
997
1009
998
1010
afterEach ( ( ) => {
@@ -1411,7 +1423,7 @@ describe('FlexibleConnectedPositionStrategy', () => {
1411
1423
1412
1424
// Create a strategy with knowledge of the scrollable container
1413
1425
const strategy = overlay . position ( )
1414
- . flexibleConnectedTo ( new ElementRef ( originElement ) )
1426
+ . flexibleConnectedTo ( originElement )
1415
1427
. withPush ( false )
1416
1428
. withPositions ( [ {
1417
1429
originX : 'start' ,
@@ -1490,7 +1502,7 @@ describe('FlexibleConnectedPositionStrategy', () => {
1490
1502
beforeEach ( ( ) => {
1491
1503
originElement = createPositionedBlockElement ( ) ;
1492
1504
document . body . appendChild ( originElement ) ;
1493
- positionStrategy = overlay . position ( ) . flexibleConnectedTo ( new ElementRef ( originElement ) ) ;
1505
+ positionStrategy = overlay . position ( ) . flexibleConnectedTo ( originElement ) ;
1494
1506
} ) ;
1495
1507
1496
1508
afterEach ( ( ) => {
@@ -1600,7 +1612,7 @@ describe('FlexibleConnectedPositionStrategy', () => {
1600
1612
beforeEach ( ( ) => {
1601
1613
originElement = createPositionedBlockElement ( ) ;
1602
1614
document . body . appendChild ( originElement ) ;
1603
- positionStrategy = overlay . position ( ) . flexibleConnectedTo ( new ElementRef ( originElement ) ) ;
1615
+ positionStrategy = overlay . position ( ) . flexibleConnectedTo ( originElement ) ;
1604
1616
} ) ;
1605
1617
1606
1618
afterEach ( ( ) => {
0 commit comments