Skip to content

Commit cd87648

Browse files
committed
test(modal): ensure opening button is focused after closing
1 parent 99ae628 commit cd87648

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/kit-headless/src/components/modal/modal.spec.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,19 @@ describe('Modal', () => {
111111
});
112112

113113
it(`GIVEN a Modal
114-
WHEN opening it
114+
WHEN opening it with a button
115115
AND clicking the backdrop
116-
THEN it is not visible any more`, () => {
116+
THEN it is not visible any more
117+
THEN it focuses the opening button`, () => {
117118
cy.mount(<Sut />);
118119

119120
cy.get('[data-test=modal-trigger]').click();
120121

121122
cy.get('body').click('top');
122123

123124
cy.get('dialog').should('not.be.visible');
125+
126+
cy.get('[data-test=modal-trigger]').should('be.focused');
124127
});
125128

126129
it(`Given a Modal

0 commit comments

Comments
 (0)