@@ -17,4 +17,81 @@ test.describe("navigation-menu", () => {
17
17
await I . hoverTrigger ( "products" )
18
18
await I . seeContent ( "products" )
19
19
} )
20
+
21
+ test ( "should open on click" , async ( ) => {
22
+ await I . clickTrigger ( "products" )
23
+ await I . seeContent ( "products" )
24
+ } )
25
+
26
+ test ( "should close when clicking outside" , async ( ) => {
27
+ await I . clickTrigger ( "products" )
28
+ await I . seeContent ( "products" )
29
+ await I . clickOutside ( )
30
+ await I . dontSeeContent ( "products" )
31
+ } )
32
+
33
+ test ( "should close when pressing escape" , async ( ) => {
34
+ await I . clickTrigger ( "products" )
35
+ await I . seeContent ( "products" )
36
+ await I . pressKey ( "Escape" )
37
+ await I . dontSeeContent ( "products" )
38
+ } )
39
+
40
+ test ( "trigger switch, using hover" , async ( ) => {
41
+ await I . hoverTrigger ( "products" )
42
+ await I . seeContent ( "products" )
43
+ await I . hoverTrigger ( "company" )
44
+ await I . seeContent ( "company" )
45
+ await I . dontSeeContent ( "products" )
46
+ } )
47
+
48
+ test ( "trigger switch, using the keyboard" , async ( ) => {
49
+ await I . focusTrigger ( "products" )
50
+ await I . pressKey ( "Enter" )
51
+ await I . seeContent ( "products" )
52
+ await I . pressKey ( "Enter" )
53
+ await I . dontSeeContent ( "products" )
54
+
55
+ await I . pressKey ( "Tab" )
56
+ await I . pressKey ( "Enter" )
57
+ await I . seeContent ( "company" )
58
+ await I . dontSeeContent ( "products" )
59
+ } )
60
+
61
+ test ( "hover + focus should toggle content" , async ( ) => {
62
+ await I . hoverTrigger ( "products" )
63
+ await I . seeContent ( "products" )
64
+ await I . clickTrigger ( "products" )
65
+ await I . dontSeeContent ( "products" )
66
+
67
+ // hover again (nothing should happen)
68
+ await I . hoverTrigger ( "products" )
69
+ await I . dontSeeContent ( "products" )
70
+ } )
71
+
72
+ test ( "focus link on tab" , async ( ) => {
73
+ await I . focusTrigger ( "products" )
74
+ await I . pressKey ( "Enter" )
75
+ await I . pressKey ( "Tab" )
76
+ await I . seeContentLinkIsFocused ( "products" , "Analytics Platform" )
77
+ } )
78
+
79
+ test ( "tab navigation" , async ( ) => {
80
+ await I . focusTrigger ( "products" )
81
+ await I . pressKey ( "Enter" )
82
+ await I . pressKey ( "Tab" , 7 )
83
+
84
+ await I . seeTriggerIsFocused ( "company" )
85
+ await I . pressKey ( "Enter" )
86
+ await I . seeContent ( "company" )
87
+ await I . dontSeeContent ( "products" )
88
+
89
+ await I . pressKey ( "Tab" , 5 )
90
+ await I . seeLinkIsFocused ( "pricing" )
91
+
92
+ // focus outside
93
+ await I . pressKey ( "Tab" )
94
+ await I . dontSeeContent ( "company" )
95
+ await I . dontSeeContent ( "products" )
96
+ } )
20
97
} )
0 commit comments