Skip to content

Commit ea67c42

Browse files
committed
fix(Label, TextField test): resolve unit-tests and code-quality CI failures
- Prettier wants the Label component destructure on one line; reformat to match. - The earlier `getAttribute('style')` assertion returned `null` when no style attribute was present, which `.not.toContain('color')` rejected. Use `element.style.color` instead, which returns `''` for "no inline color set" — the actual semantic we want to verify.
1 parent 5879c5f commit ea67c42

2 files changed

Lines changed: 4 additions & 9 deletions

File tree

src/components/Label/Label.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@ const labelVariants = cva(styles.label, {
1919
},
2020
});
2121

22-
export const Label = ({
23-
disabled,
24-
error,
25-
children,
26-
className,
27-
...props
28-
}: LabelProps) => (
22+
export const Label = ({ disabled, error, children, className, ...props }: LabelProps) => (
2923
<label
3024
{...props}
3125
className={cn(labelVariants({ disabled, error }), className)}

src/components/TextField/TextField.test.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ describe('TextField', () => {
4444
// jsdom does not load. Visual parity is covered by the Playwright
4545
// suite at tests/display/label.spec.ts. The assertion below verifies
4646
// the InputWrapper does not inject a styled-components color override
47-
// when no labelColor prop is passed.
48-
expect(labelElement.getAttribute('style')).not.toContain('color');
47+
// when no labelColor prop is passed (element.style.color is the empty
48+
// string when no inline `color` is set).
49+
expect(labelElement.style.color).toBe('');
4950
});
5051

5152
it('is the color of the passed in labelColor', () => {

0 commit comments

Comments
 (0)