Skip to content

Commit 13ab0c0

Browse files
igalklebanovgioboa
andcommitted
test(popover): add cypress suite
Co-authored-by: Giorgio Boa <35845425+gioboa@users.noreply.github.com>
1 parent 4b8aa11 commit 13ab0c0

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
});

0 commit comments

Comments
 (0)