From b125a0842c2a132ef8cc81e751cc5c49917c6ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B8egh?= Date: Tue, 16 Jan 2024 10:37:19 +0100 Subject: [PATCH] Add test for SelectCountry --- .../SelectCountry/__tests__/SelectCountry.test.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/dnb-eufemia/src/extensions/forms/Field/SelectCountry/__tests__/SelectCountry.test.tsx b/packages/dnb-eufemia/src/extensions/forms/Field/SelectCountry/__tests__/SelectCountry.test.tsx index 459fc4caa0b..8db8085e142 100644 --- a/packages/dnb-eufemia/src/extensions/forms/Field/SelectCountry/__tests__/SelectCountry.test.tsx +++ b/packages/dnb-eufemia/src/extensions/forms/Field/SelectCountry/__tests__/SelectCountry.test.tsx @@ -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', () => { @@ -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() + + 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()