perf(movimento): vitrine e 3D mais leves, WebGL por software lembrado na sessão e suporte ao WebKit
This commit is contained in:
1 parent
9fd1570426
commit
8903f3c57e
28 files changed
+854
-406
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { act, render, screen } from "@testing-library/react";
|
||||
import { setNavigation } from "@/__mocks__/next/navigation";
|
||||
import CinematicOverlays from "./CinematicOverlays";
|
||||
|
||||
/**
|
||||
@@ -6,9 +7,6 @@ import CinematicOverlays from "./CinematicOverlays";
|
||||
* com a página montada (de fora da home para a home e de volta) e as duas condições do grão juntas.
|
||||
*/
|
||||
|
||||
let mockPathname = "/";
|
||||
jest.mock("next/navigation", () => ({ usePathname: () => mockPathname }));
|
||||
|
||||
const mockLoaded = jest.fn();
|
||||
jest.mock("./FilmGrain", () => {
|
||||
mockLoaded();
|
||||
@@ -38,7 +36,7 @@ function mockMedia(active: string[] = []) {
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
mockPathname = "/";
|
||||
setNavigation({ pathname: "/" });
|
||||
mockLoaded.mockClear();
|
||||
mockMedia();
|
||||
});
|
||||
@@ -49,12 +47,12 @@ afterEach(() => {
|
||||
|
||||
describe("CinematicOverlays: troca de página", () => {
|
||||
it("path: arriving on the home from another page with a mouse -> the grain and the progress bar appear", async () => {
|
||||
mockPathname = "/cases";
|
||||
setNavigation({ pathname: "/cases" });
|
||||
const { container, rerender } = render(<CinematicOverlays />);
|
||||
await loaded();
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
|
||||
mockPathname = "/";
|
||||
setNavigation({ pathname: "/" });
|
||||
rerender(<CinematicOverlays />);
|
||||
await loaded();
|
||||
|
||||
@@ -67,12 +65,12 @@ describe("CinematicOverlays: troca de página", () => {
|
||||
await loaded();
|
||||
expect(screen.getByTestId("grain")).toBeInTheDocument();
|
||||
|
||||
mockPathname = "/servicos";
|
||||
setNavigation({ pathname: "/servicos" });
|
||||
rerender(<CinematicOverlays />);
|
||||
expect(screen.queryByTestId("grain")).toBeNull();
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
|
||||
mockPathname = "/";
|
||||
setNavigation({ pathname: "/" });
|
||||
rerender(<CinematicOverlays />);
|
||||
await loaded();
|
||||
expect(screen.getByTestId("grain")).toBeInTheDocument();
|
||||
@@ -80,7 +78,7 @@ describe("CinematicOverlays: troca de página", () => {
|
||||
});
|
||||
|
||||
it("path: a sub-route that merely starts like the home path -> not the home", async () => {
|
||||
mockPathname = "/cases/sev-modaintima";
|
||||
setNavigation({ pathname: "/cases/sev-modaintima" });
|
||||
const { container } = render(<CinematicOverlays />);
|
||||
await loaded();
|
||||
|
||||
|
||||
Reference in new issue
Block a user