Mirror: React hooks for accessible, common web interactions. UI super powers without the UI.

Add touch event to useDismissable tests

Changed files
+18 -4
src
+18 -4
src/__tests__/useDismissable.test.tsx
···
</main>
);
-
cy.get('.inside').as('inside').click();
+
cy.get('.inside').as('inside').realClick();
cy.get('@inside').should('be.visible');
-
cy.get('.outside').first().click();
+
cy.get('.outside').first().realClick();
cy.get('@inside').should('not.be.visible');
});
···
cy.get('.inside').as('inside').should('be.visible');
// at first not dismissed
-
cy.get('.outside').first().click();
+
cy.get('.outside').first().realClick();
cy.get('@inside').should('be.visible');
// dismissed when the second Dialog loses focus
-
cy.get('.outside').first().click();
+
cy.get('.outside').first().realClick();
+
cy.get('@inside').should('not.be.visible');
+
});
+
+
it('is dismissed by tapping outside', () => {
+
mount(
+
<main>
+
<button className="outside">outside</button>
+
<Dialog />
+
</main>
+
);
+
+
cy.get('.inside').as('inside').realClick();
+
cy.get('@inside').should('be.visible');
+
cy.get('.outside').first().realTouch();
cy.get('@inside').should('not.be.visible');
});