123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
- import { expect } from 'vitest'
- import renderComponent from '#tests/support/components/renderComponent.ts'
- import { setCSRFToken } from '#shared/server/apollo/utils/csrfToken.ts'
- import CommonThirdPartyAuthenticationButton from '#desktop/components/CommonThirdPartyAuthenticationButton/CommonThirdPartyAuthenticationButton.vue'
- const token = '12345'
- const url = '/auth/github'
- setCSRFToken(token)
- describe('CommonThirdPartyAuthenticationButton', () => {
- it('renders with default prop values', () => {
- const view = renderComponent(CommonThirdPartyAuthenticationButton, {
- props: {
- url,
- },
- })
- expect(view.getByRole('form')).toHaveFormValues({
- authenticity_token: token,
- })
- })
- it('renders with prop values', () => {
- const view = renderComponent(CommonThirdPartyAuthenticationButton, {
- props: {
- buttonLabel: 'GitHub',
- buttonIcon: 'github',
- url,
- },
- })
- expect(view.getByLabelText('GitHub')).toBeInTheDocument()
- expect(view.getByIconName('github')).toBeInTheDocument()
- })
- it('supports default slot', () => {
- const view = renderComponent(CommonThirdPartyAuthenticationButton, {
- props: {
- url,
- },
- slots: {
- default: () => 'GitHub',
- },
- })
- expect(view.getByText('GitHub')).toBeInTheDocument()
- })
- })
|