mirror of
https://github.com/fergalmoran/onearmy-community-platform.git
synced 2025-12-22 09:37:54 +00:00
39 lines
945 B
TypeScript
39 lines
945 B
TypeScript
import { render, screen } from '@testing-library/react'
|
|
import { HowtoProvider } from 'src/test/components'
|
|
import { describe, it } from 'vitest'
|
|
|
|
import { FormFieldWrapper } from '.'
|
|
|
|
describe('FormFieldWrapper', () => {
|
|
it('renders the props', async () => {
|
|
const text = 'Title Presented'
|
|
const htmlFor = 'html_tag'
|
|
const childrenText = 'Children rendered'
|
|
|
|
render(
|
|
<HowtoProvider>
|
|
<FormFieldWrapper text={text} htmlFor={htmlFor}>
|
|
<p>{childrenText}</p>
|
|
</FormFieldWrapper>
|
|
</HowtoProvider>,
|
|
)
|
|
|
|
await screen.findByText(text)
|
|
await screen.findByText(childrenText)
|
|
})
|
|
|
|
it('adds an asterisk with required', async () => {
|
|
const text = 'Title Presented'
|
|
|
|
render(
|
|
<HowtoProvider>
|
|
<FormFieldWrapper text={text} required>
|
|
<p></p>
|
|
</FormFieldWrapper>
|
|
</HowtoProvider>,
|
|
)
|
|
|
|
await screen.findByText('*', { exact: false })
|
|
})
|
|
})
|