@@ -31,25 +31,24 @@ describe('lion-tooltip', () => {
3131 expect ( el . querySelector ( '[slot="content"]' ) . style . display ) . to . be . equal ( 'none' ) ;
3232 } ) ;
3333
34- it ( 'should tooltip contains html when specified in tooltip content body ' , async ( ) => {
34+ it ( 'should show content on mouseenter and remain shown on focusout ' , async ( ) => {
3535 const el = await fixture ( html `
3636 < lion-tooltip >
37- < div slot ="content ">
38- This is Tooltip using < strong id ="click_overlay "> overlay</ strong >
39- </ div >
37+ < div slot ="content "> Hey there</ div >
4038 < lion-button slot ="invoker "> Tooltip button</ lion-button >
4139 </ lion-tooltip >
4240 ` ) ;
43- const invoker = el . querySelector ( '[slot="invoker"]' ) ;
44- const event = new Event ( 'mouseenter' ) ;
45- invoker . dispatchEvent ( event ) ;
41+ const eventMouseEnter = new Event ( 'mouseenter' ) ;
42+ el . dispatchEvent ( eventMouseEnter ) ;
4643 await el . updateComplete ;
47- expect ( el . querySelector ( 'strong' ) ) . to . not . be . undefined ;
44+ expect ( el . querySelector ( '[slot="content"]' ) . style . display ) . to . be . equal ( 'inline-block' ) ;
45+ const eventFocusOut = new Event ( 'focusout' ) ;
46+ el . dispatchEvent ( eventFocusOut ) ;
47+ await el . updateComplete ;
48+ expect ( el . querySelector ( '[slot="content"]' ) . style . display ) . to . be . equal ( 'inline-block' ) ;
4849 } ) ;
49- } ) ;
5050
51- describe ( 'Accessibility' , ( ) => {
52- it ( 'should visible on focusin and hide on focusout' , async ( ) => {
51+ it ( 'should show content on focusin and hide on focusout' , async ( ) => {
5352 const el = await fixture ( html `
5453 < lion-tooltip >
5554 < div slot ="content "> Hey there</ div >
@@ -67,6 +66,42 @@ describe('lion-tooltip', () => {
6766 expect ( el . querySelector ( '[slot="content"]' ) . style . display ) . to . be . equal ( 'none' ) ;
6867 } ) ;
6968
69+ it ( 'should show content on focusin and remain shown on mouseleave' , async ( ) => {
70+ const el = await fixture ( html `
71+ < lion-tooltip >
72+ < div slot ="content "> Hey there</ div >
73+ < lion-button slot ="invoker "> Tooltip button</ lion-button >
74+ </ lion-tooltip >
75+ ` ) ;
76+ const invoker = el . querySelector ( '[slot="invoker"]' ) ;
77+ const eventFocusIn = new Event ( 'focusin' ) ;
78+ invoker . dispatchEvent ( eventFocusIn ) ;
79+ await el . updateComplete ;
80+ expect ( el . querySelector ( '[slot="content"]' ) . style . display ) . to . be . equal ( 'inline-block' ) ;
81+ const eventMouseLeave = new Event ( 'mouseleave' ) ;
82+ invoker . dispatchEvent ( eventMouseLeave ) ;
83+ await el . updateComplete ;
84+ expect ( el . querySelector ( '[slot="content"]' ) . style . display ) . to . be . equal ( 'inline-block' ) ;
85+ } ) ;
86+
87+ it ( 'should tooltip contains html when specified in tooltip content body' , async ( ) => {
88+ const el = await fixture ( html `
89+ < lion-tooltip >
90+ < div slot ="content ">
91+ This is Tooltip using < strong id ="click_overlay "> overlay</ strong >
92+ </ div >
93+ < lion-button slot ="invoker "> Tooltip button</ lion-button >
94+ </ lion-tooltip >
95+ ` ) ;
96+ const invoker = el . querySelector ( '[slot="invoker"]' ) ;
97+ const event = new Event ( 'mouseenter' ) ;
98+ invoker . dispatchEvent ( event ) ;
99+ await el . updateComplete ;
100+ expect ( el . querySelector ( 'strong' ) ) . to . not . be . undefined ;
101+ } ) ;
102+ } ) ;
103+
104+ describe ( 'Accessibility' , ( ) => {
70105 it ( 'should have a tooltip role set on the tooltip' , async ( ) => {
71106 const el = await fixture ( html `
72107 < lion-tooltip >
0 commit comments