Skip to content

Commit

Permalink
Add test for SelectCountry
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Jan 16, 2024
1 parent dd158a1 commit b125a08
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { axeComponent } from '../../../../../core/jest/jestSetup'
import { fireEvent, render, waitFor } from '@testing-library/react'
import SelectCountry, { Props } from '..'
import { Provider } from '../../../../../shared'
import { Form } from '../../..'
import { Form, FormError } from '../../..'

describe('Field.SelectCountry', () => {
it('should render with props', () => {
Expand Down Expand Up @@ -267,6 +267,17 @@ describe('Field.SelectCountry', () => {
expect(selectedItemElement().textContent).toBe('Danmark')
})

it('shold display read border on dropdown', () => {
const errorMessage = new FormError('Error message')
render(<SelectCountry error={errorMessage} />)

const input = document.querySelector('.dnb-autocomplete__input')
expect(input).toHaveClass('dnb-input__status--error')

const element = document.querySelector('.dnb-form-status')
expect(element).toHaveTextContent('Error message')
})

it('should validate with ARIA rules', async () => {
const result = render(<SelectCountry value="DK" />)

Expand Down

0 comments on commit b125a08

Please sign in to comment.