Skip to content

Commit

Permalink
Update empty message combobox site example (#3640)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fercas123 authored Jun 26, 2024
1 parent 904ffa1 commit f9fd9b9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -531,11 +531,10 @@ describe("Given a ComboBox", () => {
it("should allow showing an empty message when there are no options", () => {
cy.mount(<EmptyMessage />);
cy.findByRole("combobox").realClick();
cy.realType("Missing");
cy.findAllByRole("option").should("have.length", 1);
cy.findByRole("option").should(
"have.text",
`No results found for "Missing"`
`No results found for "Yelloww"`
);
});

Expand Down
4 changes: 3 additions & 1 deletion packages/core/stories/combo-box/combo-box.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,9 @@ export const LongList: StoryFn<ComboBoxProps<CountryCode>> = (args) => {
};

export const EmptyMessage: StoryFn<ComboBoxProps> = (args) => {
const [value, setValue] = useState(args.defaultValue?.toString() ?? "");
const [value, setValue] = useState(
args.defaultValue?.toString() ?? "Yelloww"
);

const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
// React 16 backwards compatibility
Expand Down
2 changes: 1 addition & 1 deletion site/docs/components/combo-box/examples.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Wrap options in a `OptionGroup` component to group them together. Use the `label

## Empty message

Use the `Option` component to display a message when there are no options available.
To display a message when there are no options available, pass your message as a child element with `role="option"`.

</LivePreview>

Expand Down
2 changes: 1 addition & 1 deletion site/src/examples/combo-box/EmptyMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { shortColorData } from "./exampleData";
import styles from "./index.module.css";

export const EmptyMessage = (): ReactElement => {
const [value, setValue] = useState("");
const [value, setValue] = useState("Yelloww");

const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
const value = event.target.value;
Expand Down

0 comments on commit f9fd9b9

Please sign in to comment.