feat(home): seção Sobre com prova por ponto, contato por oferta e hero com a Lavação 047 na tela larga
This commit is contained in:
1 parent
d356c364e0
commit
9fd1570426
33 files changed
+1128
-369
No files matched your search
@@ -75,15 +75,38 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
describe("GoogleAnalytics: modo e teclas", () => {
|
||||
it("path: outside production -> renders nothing and never touches analytics", async () => {
|
||||
it("path: outside production -> the cookie bar and the choice are still there (dev and production behave the same), but the gtag script is never loaded", async () => {
|
||||
jest.replaceProperty(process.env, "NODE_ENV", "development");
|
||||
const user = userEvent.setup();
|
||||
|
||||
const { container } = render(<GoogleAnalytics />);
|
||||
await act(async () => {});
|
||||
render(<GoogleAnalytics />);
|
||||
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
// a barra (e o foco por Tab) é a mesma da produção
|
||||
const dialog = await screen.findByRole("dialog", {
|
||||
name: "Cookies e privacidade",
|
||||
});
|
||||
expect(dialog).toBeVisible();
|
||||
expect(
|
||||
document.documentElement.style.getPropertyValue("--cookie-bar-height"),
|
||||
).not.toBe("");
|
||||
await user.click(screen.getByRole("button", { name: "Aceitar" }));
|
||||
expect(localStorage.getItem(CONSENT_KEY)).toBe("granted");
|
||||
expect(screen.queryByRole("dialog")).toBeNull();
|
||||
expect(analyticsWindow.dataLayer).toBeUndefined();
|
||||
// mesmo com o consentimento, fora da produção o gtag não é baixado
|
||||
await act(async () => {});
|
||||
expect(screen.queryByTestId("google-analytics-script")).toBeNull();
|
||||
expect(document.getElementById("google-analytics-script")).toBeNull();
|
||||
});
|
||||
|
||||
it("path: the same consent in production loads the gtag script (the only thing tied to NODE_ENV)", async () => {
|
||||
const user = userEvent.setup();
|
||||
|
||||
render(<GoogleAnalytics />);
|
||||
await user.click(await screen.findByRole("button", { name: "Aceitar" }));
|
||||
|
||||
expect(
|
||||
await screen.findByTestId("google-analytics-script"),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("path: Escape on the first-visit bar -> bar stays and no choice is stored", async () => {
|
||||
|
||||
Reference in new issue
Block a user