-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add developer console banner * Preview all branches with demo keyword * Close widget after saving call
- Loading branch information
Showing
7 changed files
with
92 additions
and
10 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,29 @@ | ||
import { ReactElement, MouseEventHandler } from "react"; | ||
import { LinkButton } from "./Components"; | ||
|
||
function Alert({ | ||
title, | ||
onConfirm, | ||
}: { | ||
title: string | ReactElement; | ||
onConfirm: MouseEventHandler<HTMLButtonElement>; | ||
}) { | ||
return ( | ||
<div | ||
style={{ | ||
backgroundColor: "white", | ||
border: "2px solid #CBD6E2", | ||
padding: "10px", | ||
display: "flex", | ||
fontSize: "13px", | ||
}} | ||
> | ||
{title} | ||
<LinkButton use="transparent-on-primary" onClick={onConfirm}> | ||
× | ||
</LinkButton> | ||
</div> | ||
); | ||
} | ||
|
||
export default Alert; |
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
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,38 @@ | ||
import { screen, waitForElementToBeRemoved } from "@testing-library/react"; | ||
import App from "../../../src/components/App"; | ||
import { renderWithWrapper } from "../../render"; | ||
|
||
describe("App", () => { | ||
it("Shows login screen", () => { | ||
renderWithWrapper(<App />); | ||
expect( | ||
screen.getByText("Log into your calling account") | ||
).toBeInTheDocument(); | ||
}); | ||
|
||
it("Shows alert", () => { | ||
renderWithWrapper(<App />); | ||
expect( | ||
screen.getByText( | ||
/Open your console to see the incoming and outgoing messages with HubSpot./i | ||
) | ||
).toBeInTheDocument(); | ||
}); | ||
|
||
it("Hides alert when confirm button is clicked", async () => { | ||
renderWithWrapper(<App />); | ||
const confirmAlertButton = screen.getByRole("button", { name: /×/i }); | ||
confirmAlertButton.click(); | ||
|
||
await waitForElementToBeRemoved(() => | ||
screen.getByText( | ||
/Open your console to see the incoming and outgoing messages with HubSpot./i | ||
) | ||
); | ||
expect( | ||
screen.queryByText( | ||
/Open your console to see the incoming and outgoing messages with HubSpot./i | ||
) | ||
).not.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
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