diff --git a/src/features/qword/QWord.test.tsx b/src/features/qword/QWord.test.tsx index ee303b5..21390da 100644 --- a/src/features/qword/QWord.test.tsx +++ b/src/features/qword/QWord.test.tsx @@ -23,6 +23,43 @@ describe("qwordCurrentPageFromViewport", () => { }); describe("QWord", () => { + it("держит ленту QWord вне прокручиваемой области документа", () => { + const originalResizeObserver = globalThis.ResizeObserver; + const originalRequestAnimationFrame = window.requestAnimationFrame; + + globalThis.ResizeObserver = class { + observe() {} + disconnect() {} + } as unknown as typeof ResizeObserver; + window.requestAnimationFrame = ((callback: FrameRequestCallback) => { + callback(0); + return 1; + }) as typeof window.requestAnimationFrame; + + const document: WordDocument = { + id: "word-ribbon-layout-test", + title: "Лента.docx", + updatedAt: "2026-06-02T00:00:00.000Z", + html: "

Текст

" + }; + + try { + const view = render(); + const toolbar = view.container.querySelector(".word-module-toolbar") as HTMLElement; + const stage = view.container.querySelector(".document-stage") as HTMLElement; + + expect(toolbar).toBeInTheDocument(); + expect(stage).toBeInTheDocument(); + expect(stage).not.toContainElement(toolbar); + expect(toolbar.querySelector(".word-ribbon-tabs")).toBeInTheDocument(); + expect(stage.querySelector(".page-ruler")).toBeInTheDocument(); + expect(stage.querySelector(".paper-frame")).toBeInTheDocument(); + } finally { + globalThis.ResizeObserver = originalResizeObserver; + window.requestAnimationFrame = originalRequestAnimationFrame; + } + }); + it("переключает вкладки ленты и показывает команды выбранной вкладки", () => { const originalResizeObserver = globalThis.ResizeObserver; const originalRequestAnimationFrame = window.requestAnimationFrame; diff --git a/src/features/qword/QWord.tsx b/src/features/qword/QWord.tsx index 46e439d..016aa06 100644 --- a/src/features/qword/QWord.tsx +++ b/src/features/qword/QWord.tsx @@ -686,8 +686,7 @@ export function QWord({ document, zoom = 100, onChange, onStatusChange }: QWordP return (
-
-
+
) : null}
-
+
+