-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating banner messages and adding tests for it
- Loading branch information
Showing
2 changed files
with
39 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { render, screen } from "@testing-library/react" | ||
import { StatusBanner } from "./StatusBanner" | ||
|
||
describe("Status banner", () => { | ||
it("displays specific failure message", () => { | ||
render(<StatusBanner status="failure" statusMessage="Specific failure" />) | ||
expect( | ||
screen.getByText(/Specific failure Please try again/) | ||
).toBeInTheDocument() | ||
expect(screen.getByRole("link")).toHaveAttribute( | ||
"href", | ||
"https://www.nypl.org/get-help/contact-us" | ||
) | ||
expect(screen.getByRole("complementary")).toHaveAttribute( | ||
"data-type", | ||
"negative" | ||
) | ||
}) | ||
|
||
it("displays general failure message", () => { | ||
render(<StatusBanner status="failure" statusMessage="" />) | ||
expect(screen.getByText(/Your changes were not saved/)).toBeInTheDocument() | ||
expect(screen.getByRole("complementary")).toHaveAttribute( | ||
"data-type", | ||
"negative" | ||
) | ||
}) | ||
|
||
it("displays success message", () => { | ||
render(<StatusBanner status="success" statusMessage="" />) | ||
expect(screen.getByText(/Your changes were saved/)).toBeInTheDocument() | ||
expect(screen.getByRole("complementary")).toHaveAttribute( | ||
"data-type", | ||
"positive" | ||
) | ||
}) | ||
}) |
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