This repository has been archived by the owner on Mar 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent form submission for WidgetTooltip
- Loading branch information
1 parent
6643a24
commit bd2daa8
Showing
3 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react' | ||
import { TooltipProvider } from '@radix-ui/react-tooltip' | ||
|
||
import { WidgetTooltip } from '../../src' | ||
|
||
describe('<WidgetTooltip/>', () => { | ||
it('should not submit the parent form', () => { | ||
const stubbedHandleSubmit = cy.stub().as('stubbedHandleSubmit') | ||
|
||
cy.mount( | ||
<form | ||
onSubmit={ev => { | ||
ev.preventDefault() | ||
stubbedHandleSubmit() | ||
}} | ||
> | ||
<TooltipProvider> | ||
<WidgetTooltip helpText='the help text' triggerAriaLabel='get help' /> | ||
</TooltipProvider> | ||
</form> | ||
) | ||
|
||
cy.findByLabelText('get help').click() | ||
|
||
cy.get('@stubbedHandleSubmit').should('not.have.been.called') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters