Align the notebook browser with the physical LCD, refresh real project captures and navigation, simplify service content, and stabilize hero hydration.
This commit is contained in:
1 parent
e2b20bc699
commit
8b12e51bc5
35 files changed
+2359
-1299
No files matched your search
@@ -1,10 +1,6 @@
|
||||
import { act, render, screen, waitFor } from "@testing-library/react";
|
||||
import { getFeaturedProjects } from "@/lib/portfolio-data";
|
||||
import NotebookStory, {
|
||||
canUseNotebook3D,
|
||||
getNotebookRunwayVh,
|
||||
getNotebookSeekProgress,
|
||||
} from "./NotebookStory";
|
||||
import NotebookStory, { canUseNotebook3D } from "./NotebookStory";
|
||||
|
||||
const mockNotebookStage = jest.fn(({ isVisible }: { isVisible: boolean }) => (
|
||||
<div data-is-visible={String(isVisible)} data-testid="notebook-stage" />
|
||||
@@ -135,15 +131,10 @@ describe("NotebookStory", () => {
|
||||
await waitFor(() =>
|
||||
expect(screen.getByTestId("notebook-stage")).toBeInTheDocument(),
|
||||
);
|
||||
expect(
|
||||
screen.getByLabelText("Projetos em produção no notebook"),
|
||||
).toHaveAttribute("data-notebook-runway-vh", "520");
|
||||
});
|
||||
|
||||
it("stays paused when the tab returns while the section is offscreen", async () => {
|
||||
const addEventListener = jest.spyOn(document, "addEventListener");
|
||||
const removeEventListener = jest.spyOn(document, "removeEventListener");
|
||||
const { unmount } = render(<NotebookStory projects={projects} />);
|
||||
render(<NotebookStory projects={projects} />);
|
||||
|
||||
const stage = await screen.findByTestId("notebook-stage");
|
||||
expect(stage).toHaveAttribute("data-is-visible", "false");
|
||||
@@ -163,18 +154,6 @@ describe("NotebookStory", () => {
|
||||
setDocumentHidden(false);
|
||||
act(() => document.dispatchEvent(new Event("visibilitychange")));
|
||||
expect(stage).toHaveAttribute("data-is-visible", "false");
|
||||
|
||||
expect(
|
||||
addEventListener.mock.calls.filter(
|
||||
([type]) => type === "visibilitychange",
|
||||
),
|
||||
).toHaveLength(1);
|
||||
unmount();
|
||||
expect(
|
||||
removeEventListener.mock.calls.filter(
|
||||
([type]) => type === "visibilitychange",
|
||||
),
|
||||
).toHaveLength(1);
|
||||
});
|
||||
it("returns to the static fallback when the viewport loses desktop eligibility", async () => {
|
||||
render(<NotebookStory projects={projects} />);
|
||||
@@ -208,12 +187,6 @@ describe("NotebookStory", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("scales the runway from the number of projects", () => {
|
||||
expect(getNotebookRunwayVh(1)).toBe(400);
|
||||
expect(getNotebookRunwayVh(4)).toBe(520);
|
||||
expect(getNotebookRunwayVh(99)).toBe(4320);
|
||||
});
|
||||
|
||||
it("requires desktop hover input without reduced motion", () => {
|
||||
const matchMedia = (query: string) =>
|
||||
({
|
||||
@@ -245,27 +218,4 @@ describe("NotebookStory", () => {
|
||||
screen.queryByRole("tab", { name: /Twins Lab/i }),
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("maps tab seeks inside the browse window without a second scroll engine", () => {
|
||||
const first = getNotebookSeekProgress(0, 4);
|
||||
const middle = getNotebookSeekProgress(2, 4);
|
||||
const last = getNotebookSeekProgress(3, 4);
|
||||
|
||||
expect(first).toBeGreaterThanOrEqual(0.44);
|
||||
expect(first).toBeLessThan(0.78);
|
||||
expect(middle).toBeGreaterThan(first);
|
||||
expect(last).toBeLessThan(0.78);
|
||||
expect(getNotebookSeekProgress(99, 4)).toBeLessThan(0.78);
|
||||
});
|
||||
|
||||
it("does not register a global scroll listener", () => {
|
||||
const addEventListener = jest.spyOn(window, "addEventListener");
|
||||
mockMatchMedia({ reduced: true });
|
||||
|
||||
render(<NotebookStory projects={projects} />);
|
||||
|
||||
expect(
|
||||
addEventListener.mock.calls.some(([type]) => type === "scroll"),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user