diff --git a/packages/text-input/src/TextInput/TextInput.spec.tsx b/packages/text-input/src/TextInput/TextInput.spec.tsx index bc50fa648c..4be380094e 100644 --- a/packages/text-input/src/TextInput/TextInput.spec.tsx +++ b/packages/text-input/src/TextInput/TextInput.spec.tsx @@ -47,12 +47,27 @@ describe('packages/text-input', () => { expect(results).toHaveNoViolations(); }); }); + test(`renders ${defaultProps.label} as the input label and ${defaultProps.description} as the description`, () => { const { label, description } = renderTextInput(defaultProps); expect(label?.innerHTML).toContain(defaultProps.label); expect(description?.innerHTML).toContain(defaultProps.description); }); + test('allows external label', () => { + const { getByTestId } = render( + <> + + + , + ); + + const input = getByTestId('input'); + expect(input).toBeLabelled(); + }); + test(`renders ${defaultProps.placeholder} as placeholder text`, () => { const { getByPlaceholderText } = renderTextInput(defaultProps); expect(getByPlaceholderText(defaultProps.placeholder)).toBeVisible();