@@ -2,6 +2,7 @@ import { expect } from '@esm-bundle/chai';
22import {
33 arrowDown ,
44 arrowRight ,
5+ aTimeout ,
56 escKeyDown ,
67 fire ,
78 fixtureSync ,
@@ -62,6 +63,14 @@ describe('menu-bar with tooltip', () => {
6263 expect ( tooltip . opened ) . to . be . true ;
6364 } ) ;
6465
66+ it ( 'should use hover delay on menu button mouseover' , async ( ) => {
67+ tooltip . hoverDelay = 10 ;
68+ mouseover ( buttons [ 0 ] ) ;
69+ expect ( tooltip . opened ) . to . be . false ;
70+ await aTimeout ( 10 ) ;
71+ expect ( tooltip . opened ) . to . be . true ;
72+ } ) ;
73+
6574 it ( 'should use the tooltip property of an item as tooltip' , ( ) => {
6675 mouseover ( buttons [ 0 ] ) ;
6776 expect ( getTooltipText ( ) ) . to . equal ( 'Edit tooltip' ) ;
@@ -87,6 +96,15 @@ describe('menu-bar with tooltip', () => {
8796 expect ( tooltip . opened ) . to . be . false ;
8897 } ) ;
8998
99+ it ( 'should use hide delay on menu button mouseleave' , async ( ) => {
100+ tooltip . hideDelay = 10 ;
101+ mouseover ( buttons [ 0 ] ) ;
102+ mouseleave ( menuBar ) ;
103+ expect ( tooltip . opened ) . to . be . true ;
104+ await aTimeout ( 10 ) ;
105+ expect ( tooltip . opened ) . to . be . false ;
106+ } ) ;
107+
90108 it ( 'should hide tooltip on menu bar container mouseover' , ( ) => {
91109 mouseover ( buttons [ 0 ] ) ;
92110 mouseover ( menuBar . _container ) ;
@@ -123,6 +141,13 @@ describe('menu-bar with tooltip', () => {
123141 expect ( tooltip . opened ) . to . be . false ;
124142 } ) ;
125143
144+ it ( 'should not use hide delay on menu button mousedown' , ( ) => {
145+ tooltip . hideDelay = 10 ;
146+ mouseover ( buttons [ 0 ] ) ;
147+ mousedown ( buttons [ 0 ] ) ;
148+ expect ( tooltip . opened ) . to . be . false ;
149+ } ) ;
150+
126151 it ( 'should not show tooltip on focus without keyboard interaction' , async ( ) => {
127152 buttons [ 0 ] . focus ( ) ;
128153 await nextRender ( ) ;
@@ -135,6 +160,15 @@ describe('menu-bar with tooltip', () => {
135160 expect ( tooltip . opened ) . to . be . true ;
136161 } ) ;
137162
163+ it ( 'should use focus delay on menu button keyboard focus' , async ( ) => {
164+ tooltip . focusDelay = 10 ;
165+ tabKeyDown ( document . body ) ;
166+ focusin ( buttons [ 0 ] ) ;
167+ expect ( tooltip . opened ) . to . be . false ;
168+ await aTimeout ( 10 ) ;
169+ expect ( tooltip . opened ) . to . be . true ;
170+ } ) ;
171+
138172 it ( 'should not show tooltip on another parent menu button focus when open' , async ( ) => {
139173 buttons [ 0 ] . focus ( ) ;
140174 arrowRight ( buttons [ 0 ] ) ;
@@ -171,6 +205,14 @@ describe('menu-bar with tooltip', () => {
171205 expect ( tooltip . opened ) . to . be . false ;
172206 } ) ;
173207
208+ it ( 'should not use hide delay on menu button Esc' , ( ) => {
209+ tooltip . hideDelay = 10 ;
210+ tabKeyDown ( document . body ) ;
211+ focusin ( buttons [ 0 ] ) ;
212+ escKeyDown ( buttons [ 0 ] ) ;
213+ expect ( tooltip . opened ) . to . be . false ;
214+ } ) ;
215+
174216 it ( 'should set tooltip opened to false when the menuBar is removed' , ( ) => {
175217 mouseover ( buttons [ 0 ] ) ;
176218
0 commit comments