Skip to content

Commit

Permalink
fixup! BREAKING CHANGE(web-react): id prop is required for all form c…
Browse files Browse the repository at this point in the history
…omponents #DS-885
  • Loading branch information
curdaj committed May 14, 2024
1 parent c3b436e commit 493c4e9
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ import TextFieldBase from '../TextFieldBase';
describe('TextFieldBase', () => {
describe.each(['text', 'password', 'email'])('input type %s', (type) => {
it('should have connected label and input', () => {
const dom = render(<TextFieldBase id="textfield-base" label="Label" type={type as TextFieldType} />);
const dom = render(<TextFieldBase id="textfieldbase" label="Label" type={type as TextFieldType} />);

const labelElement = dom.container.querySelector('label') as HTMLElement;
expect(labelElement).toHaveAttribute('for', 'textfield-base');
expect(labelElement).toHaveAttribute('for', 'textfieldbase');

const inputElement = dom.container.querySelector('input') as HTMLElement;
expect(inputElement).toHaveAttribute('id', 'textfield-base');
expect(inputElement).toHaveAttribute('id', 'textfieldbase');
});

it('should have correct id', () => {
render(<TextFieldBase id="textfield-base" label="Label" type={type as TextFieldType} />);
render(<TextFieldBase id="textfieldbase" label="Label" type={type as TextFieldType} />);
const inputElement = screen.getByLabelText('Label');

expect(inputElement).toHaveAttribute('id', 'textfield-base');
expect(inputElement).toHaveAttribute('id', 'textfieldbase');
});
});
});

0 comments on commit 493c4e9

Please sign in to comment.