@@ -25,7 +25,7 @@ describe('Trigger.Point', () => {
25
25
< div
26
26
className = "scroll"
27
27
// Jest can not get calculated style in jsdom. So we need to set it manually
28
- style = { { overflowX : 'hidden' , overflowY : 'hidden' } }
28
+ style = { { overflowX : 'hidden' , overflowY : 'hidden' , width : 500 , height : 500 } }
29
29
>
30
30
< Trigger
31
31
ref = { this . props . triggerRef }
@@ -34,7 +34,7 @@ describe('Trigger.Point', () => {
34
34
alignPoint
35
35
{ ...this . props }
36
36
>
37
- < div className = "point-region" />
37
+ < div className = "point-region" style = { { width : 100 , height : 200 } } />
38
38
</ Trigger >
39
39
</ div >
40
40
) ;
@@ -141,6 +141,27 @@ describe('Trigger.Point', () => {
141
141
142
142
expect ( document . querySelector ( '.rc-trigger-popup-hidden' ) ) . toBeTruthy ( ) ;
143
143
} ) ;
144
+
145
+ it ( 'should default to targets position when shown in controlled manner' , async ( ) => {
146
+ // TODO:
147
+ // This test does not work at all at the moment, because useAlign calls
148
+ // isVisible on the trigger's target (div with class "point-region").
149
+ // For that div, getBoundingClientRect() always returns a width and height
150
+ // of zero. Therefore, it is interpreted as not visible and useAlign
151
+ // returns ready==false.
152
+ const { container } = render ( < Demo popupVisible action = { [ ] } /> ) ;
153
+ await trigger ( container , 'click' , { clientX : 11 , clientY : 28 } ) ;
154
+ await trigger ( container , 'mouseenter' , { clientX : 10 , clientY : 20 } ) ;
155
+ await trigger ( container , 'mouseover' , { clientX : 9 , clientY : 3 } ) ;
156
+
157
+ const popup = document . querySelector ( '.rc-trigger-popup' ) ;
158
+ console . log ( "popup.style.left" , popup . style . left ) ;
159
+ console . log ( "popup.style.top" , popup . style . top ) ;
160
+
161
+
162
+ // todo: compare with proper value
163
+ expect ( popup . style . left ) . toEqual ( 0 ) ;
164
+ } ) ;
144
165
} ) ;
145
166
146
167
describe ( 'placement' , ( ) => {
0 commit comments