This repository has been archived by the owner on Jul 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EVG-19973: Improve patch parameters modal
- Loading branch information
Showing
3 changed files
with
62 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { render, screen, userEvent } from "test_utils"; | ||
import { ParametersModal } from "./ParametersModal"; | ||
|
||
const parameters = [ | ||
{ key: "Key 1", value: "Value 1" }, | ||
{ key: "Key 2", value: "Value 2" }, | ||
]; | ||
|
||
describe("parameters modal", () => { | ||
it("modal is closed by default", () => { | ||
render(<ParametersModal parameters={parameters} />); | ||
expect(screen.queryByDataCy("parameters-modal")).toBeNull(); | ||
}); | ||
|
||
it("link does not render if there are no parameters", () => { | ||
render(<ParametersModal parameters={[]} />); | ||
expect(screen.queryByDataCy("parameters-link")).toBeNull(); | ||
}); | ||
|
||
it("can click the link to open the modal and view parameters", async () => { | ||
const user = userEvent.setup(); | ||
render(<ParametersModal parameters={parameters} />); | ||
await user.click(screen.getByDataCy("parameters-link")); | ||
await screen.findByDataCy("parameters-modal"); | ||
expect(screen.getByText(parameters[0].key)).toBeInTheDocument(); | ||
expect(screen.getByText(parameters[0].value)).toBeInTheDocument(); | ||
expect(screen.getByText(parameters[1].key)).toBeInTheDocument(); | ||
expect(screen.getByText(parameters[1].value)).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters