Skip to content

Commit

Permalink
chore: test title, resolve type error
Browse files Browse the repository at this point in the history
  • Loading branch information
junghyeonsu committed Jul 5, 2024
1 parent f7af9bc commit ac7ed3a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
7 changes: 1 addition & 6 deletions examples/stackflow-spa/src/activities/ActivityTextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ import { TextField } from "../design-system/components";
const ActivityTextField: ActivityComponentType = () => {
return (
<AppScreen appBar={{ title: "TextField" }}>
<TextField
variant="outlined"
invalid
description="디스크립션이에용"
errorMessage="에러에용"
/>
<TextField variant="outlined" />
</AppScreen>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>((pro
isInvalid,
isRequired,
graphemes,
} = useTextField({ ...props, elementType: "input" });
} = useTextField({ ...props });

const showErrorMessage = isInvalid && !!errorMessage;
const indicator = isRequired ? requiredIndicator : optionalIndicator;
Expand Down
9 changes: 8 additions & 1 deletion packages/react-headless/text-field/src/useTextField.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,14 @@ describe("useTextField", () => {
expect(input).toHaveAttribute("aria-required", "true");
});

it("should not render the input with aria-describedby when only errorMessage is provided", () => {
it("should not render the input with aria-describedby when provided neither description nor errorMessage", () => {
const { getByRole } = setUp(<TextField />);
const input = getByRole("textbox");

expect(input).not.toHaveAttribute("aria-describedby");
});

it("should not render the input with aria-describedby when errorMessage is provided without invalid=ture", () => {
const { getByRole } = setUp(<TextField errorMessage="error" />);
const input = getByRole("textbox");

Expand Down

0 comments on commit ac7ed3a

Please sign in to comment.