File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
packages/kit-headless/src/components/popover Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { component$ } from '@builder.io/qwik' ;
2
+ import { Popover } from './popover' ;
3
+ import { PopoverContent } from './popover-content' ;
4
+ import { PopoverTrigger } from './popover-trigger' ;
5
+
6
+ const PopoverComponent = component$ ( ( ) => {
7
+ return (
8
+ < Popover >
9
+ < PopoverContent > popover content</ PopoverContent >
10
+ < PopoverTrigger > trigger text</ PopoverTrigger >
11
+ </ Popover >
12
+ ) ;
13
+ } ) ;
14
+
15
+ describe ( 'Popover' , ( ) => {
16
+ it ( 'INIT' , ( ) => {
17
+ cy . mount ( < PopoverComponent /> ) ;
18
+
19
+ cy . checkA11yForComponent ( ) ;
20
+ } ) ;
21
+
22
+ it ( 'should render the component' , ( ) => {
23
+ cy . mount ( < PopoverComponent /> ) ;
24
+
25
+ cy . findByRole ( 'button' ) . should ( 'contain' , 'trigger text' ) ;
26
+ cy . findByRole ( 'dialog' ) . should ( 'not.have.class' , 'open' ) ;
27
+ } ) ;
28
+
29
+ it ( 'should open the popover on click' , ( ) => {
30
+ cy . mount ( < PopoverComponent /> ) ;
31
+
32
+ cy . findByRole ( 'button' ) . click ( ) ;
33
+
34
+ cy . findByRole ( 'dialog' )
35
+ . should ( 'have.class' , 'open' )
36
+ . should ( 'contain' , 'popover content' ) ;
37
+ } ) ;
38
+ } ) ;
You can’t perform that action at this time.
0 commit comments