@@ -3,8 +3,10 @@ import {animationFrame} from '@shopify/jest-dom-mocks';
33import  { mountWithApp }  from  'tests/utilities' ; 
44
55import  type  { ActionMenuProps }  from  '../../ActionMenu' ; 
6+ import  type  { ActionTooltip }  from  '../../../types' ; 
67import  { Badge }  from  '../../Badge' ; 
78import  { Card }  from  '../../Card' ; 
9+ import  { Tooltip }  from  '../../Tooltip' ; 
810import  { Page ,  PageProps }  from  '../Page' ; 
911import  { Header }  from  '../components' ; 
1012
@@ -290,6 +292,47 @@ describe('<Page />', () => {
290292      expect ( page ) . not . toContainReactComponent ( Header ) ; 
291293    } ) ; 
292294  } ) ; 
295+ 
296+   describe ( '<Tooltip />' ,  ( )  =>  { 
297+     const  saveTooltip : ActionTooltip  =  { 
298+       content : 'Save tooltip' , 
299+       dismissOnMouseOut : true , 
300+     } ; 
301+ 
302+     it ( 'is rendered when available for primary action' ,  ( )  =>  { 
303+       const  page  =  mountWithApp ( 
304+         < Page 
305+           { ...mockProps } 
306+           primaryAction = { { content : 'Save' ,  tooltip : saveTooltip } } 
307+         /> , 
308+       ) ; 
309+       expect ( page ) . toContainReactComponent ( Tooltip ,  saveTooltip ) ; 
310+     } ) ; 
311+ 
312+     it ( 'is rendered when available for secondary actions' ,  ( )  =>  { 
313+       const  page  =  mountWithApp ( 
314+         < Page 
315+           { ...mockProps } 
316+           secondaryActions = { [ { content : 'Save' ,  tooltip : saveTooltip . content } ] } 
317+         /> , 
318+       ) ; 
319+       expect ( page ) . toContainReactComponent ( Tooltip ,  { 
320+         content : saveTooltip . content , 
321+       } ) ; 
322+     } ) ; 
323+ 
324+     it ( 'will NOT be rendered when primary & secondary actions have no tooltip passed' ,  ( )  =>  { 
325+       const  page  =  mountWithApp ( 
326+         < Page 
327+           { ...mockProps } 
328+           primaryAction = { { content : 'Save' } } 
329+           secondaryActions = { [ { content : 'Load' } ] } 
330+         /> , 
331+       ) ; 
332+ 
333+       expect ( page ) . not . toContainReactComponent ( Tooltip ) ; 
334+     } ) ; 
335+   } ) ; 
293336} ) ; 
294337
295338function  noop ( )  { } 
0 commit comments