Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(editor): No need to add click emitting click events, VUE delegate…
…s the handler to the root element of the component (#7182)
- Loading branch information
Showing
2 changed files
with
25 additions
and
2 deletions.
There are no files selected for viewing
3 changes: 1 addition & 2 deletions
3
packages/editor-ui/src/components/CredentialEdit/OauthButton.vue
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
24 changes: 24 additions & 0 deletions
24
packages/editor-ui/src/components/CredentialEdit/__tests__/OauthButton.test.ts
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,24 @@ | ||
import userEvent from '@testing-library/user-event'; | ||
import { createTestingPinia } from '@pinia/testing'; | ||
import { createComponentRenderer } from '@/__tests__/render'; | ||
import OauthButton from '@/components/CredentialEdit/OauthButton.vue'; | ||
|
||
const renderComponent = createComponentRenderer(OauthButton, { | ||
pinia: createTestingPinia(), | ||
}); | ||
|
||
describe('OauthButton', () => { | ||
test.each([ | ||
['GoogleAuthButton', true], | ||
['n8n-button', false], | ||
])('should emit click event only once when %s is clicked', async (name, isGoogleOAuthType) => { | ||
const { emitted, getByRole } = renderComponent({ | ||
props: { isGoogleOAuthType }, | ||
}); | ||
|
||
const button = getByRole('button'); | ||
await userEvent.click(button); | ||
|
||
expect(emitted().click).toHaveLength(1); | ||
}); | ||
}); |