diff --git a/packages/react/src/components/FluidTimePicker/__tests__/FluidTimePicker-test.js b/packages/react/src/components/FluidTimePicker/__tests__/FluidTimePicker-test.js index fa7c18814e81..d057b2e6cc85 100644 --- a/packages/react/src/components/FluidTimePicker/__tests__/FluidTimePicker-test.js +++ b/packages/react/src/components/FluidTimePicker/__tests__/FluidTimePicker-test.js @@ -9,7 +9,8 @@ import React from 'react'; import FluidTimePicker from '../FluidTimePicker'; import FluidTimePickerSelect from '../../FluidTimePickerSelect'; import SelectItem from '../../SelectItem'; -import { render } from '@testing-library/react'; +import { render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; const prefix = 'cds'; @@ -60,5 +61,81 @@ describe('FluidTimePicker', () => { expect(container.firstChild).toHaveClass(`${prefix}--time-picker--fluid`); }); + + it('returns invalidText when invalid is true', async () => { + render( + + + + + + + + + + + + + ); + await expect(screen.getByText('Invalid text')).toBeInTheDocument(); + }); + + it('returns warnText when warn is true', async () => { + render( + + + + + + + + + + + + + ); + await expect(screen.getByText('Warn text')).toBeInTheDocument(); + }); + + it('should set disabled as expected', () => { + const onClick = jest.fn(); + + render( + + + + + + + + + + + + + ); + + userEvent.click(screen.getByRole('textbox')); + expect(onClick).not.toHaveBeenCalled(); + }); }); });