This repository was archived by the owner on Dec 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,9 @@ export const usePopper = (
4545 left : '0' ,
4646 top : '0' ,
4747 } ,
48+ arrow : {
49+ position : 'absolute' ,
50+ } ,
4851 } ,
4952 attributes : { } ,
5053 } ) ;
Original file line number Diff line number Diff line change @@ -90,4 +90,24 @@ describe('userPopper', () => {
9090
9191 expect ( destroy ) . toHaveBeenCalled ( ) ;
9292 } ) ;
93+
94+ it ( 'Initializes the arrow positioning' , async ( ) => {
95+ const arrowElement = document . createElement ( 'div' ) ;
96+ const popperElementWithArrow = document . createElement ( 'div' ) ;
97+ popperElementWithArrow . appendChild ( arrowElement ) ;
98+
99+ const { result, waitForNextUpdate } = renderHook ( ( ) =>
100+ usePopper ( referenceElement , popperElementWithArrow , {
101+ placement : "bottom" ,
102+ modifiers : [ { name : "arrow" , options : { element : arrowElement } } ]
103+ } )
104+ ) ;
105+
106+ expect ( result . current . styles . arrow . position ) . toBe ( 'absolute' ) ;
107+ expect ( result . current . styles . arrow . transform ) . toBeUndefined ( ) ;
108+
109+ await waitForNextUpdate ( ) ;
110+
111+ expect ( result . current . styles . arrow . transform ) . toBeDefined ( ) ;
112+ } ) ;
93113} ) ;
You can’t perform that action at this time.
0 commit comments