CEC-4564: add trie select component (#404)

* add TrieSelect

* setup menu button

* CEC-4564: add trie select component

* CEC-4564: fix selectall bool check

* update tests
This commit is contained in:
Tristan Timblin
2023-07-31 11:08:23 -04:00
committed by GitHub
parent 56dd4a0c8f
commit 5716832a81
10 changed files with 1460 additions and 85 deletions

View File

@@ -0,0 +1,54 @@
import React from "react";
import { render, waitFor } from "@testing-library/react";
import userEvent from '@testing-library/user-event';
import { TrieSelect } from ".";
import addSnapshotSerializer from "../../../utils/snapshot";
const options = [
"ace",
"ace_bev_one",
"ace_bev_two",
"ace_bev_three",
"bev",
"bev_chaz_deep",
"bev_chaz_deep_one",
"bev_chaz_deep_two",
];
describe("TrieSelect", () => {
beforeAll(() => {
addSnapshotSerializer(expect);
});
it("Render", async () => {
const { container } = render(
<TrieSelect
label={"The button label"}
classification="Signal"
options={options}
/>
);
await waitFor(() => {
/* render */
});
expect(container).toMatchSnapshot();
});
it("properly passes payload to callback", async () => {
const mockCallback = jest.fn();
const { getByText } = render(
<TrieSelect
label={"The input label"}
classification="Signal"
options={options}
onChange={mockCallback}
/>
);
const selectAll = getByText("Select All 8");
userEvent.click(selectAll);
expect(mockCallback).toHaveBeenCalledWith(options);
});
});