Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexZorkin committed Jan 10, 2022
1 parent 7a6418a commit aa9e080
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions app/tests/unit/lib/theme/widgets/SelectParentWidget.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,34 +58,28 @@ const props: any = {
describe("The SelectParentWidget Widget", () => {
it("selects the first option from parent", async () => {
render(<SelectParentWidget {...props} />);
const parentDropdown = screen.getByLabelText("Parent Label")
expect(parentDropdown.value).toEqual(
"parent placeholder"
);
const parentDropdown = screen.getByLabelText("Parent Label");
expect(parentDropdown.value).toEqual("parent placeholder");
fireEvent.change(parentDropdown, { target: { value: "1" } });
expect(parentDropdown.value).toEqual("1");
});

it("selects the first option from child", async () => {
render(<SelectParentWidget {...props} />);
const childDropdown = screen.getByLabelText("Child Label")
const parentDropdown = screen.getByLabelText("Parent Label")
const childDropdown = screen.getByLabelText("Child Label");
const parentDropdown = screen.getByLabelText("Parent Label");
fireEvent.change(parentDropdown, { target: { value: "2" } });
expect(childDropdown.value).toEqual(
"child placeholder"
);
expect(childDropdown.value).toEqual("child placeholder");
fireEvent.change(childDropdown, { target: { value: "3" } });
expect(childDropdown.value).toEqual("3");
});

it("cannot select the first option from child with non-selected parent", async () => {
render(<SelectParentWidget {...props} />);
const childDropdown = screen.getByLabelText("Child Label")
const parentDropdown = screen.getByLabelText("Parent Label")
const childDropdown = screen.getByLabelText("Child Label");
const parentDropdown = screen.getByLabelText("Parent Label");
fireEvent.change(parentDropdown, { target: { value: "2" } });
expect(childDropdown.value).toEqual(
"child placeholder"
);
expect(childDropdown.value).toEqual("child placeholder");
fireEvent.change(childDropdown, { target: { value: "1" } });
expect(childDropdown.value).toEqual("");
});
Expand Down

0 comments on commit aa9e080

Please sign in to comment.