功能(文档预览):集成 ONLYOFFICE 安全只读预览与工作台体验
新增 ONLYOFFICE 配置签名、内部内容接口、容器编排与反向代理。 打通网页端和桌面端独立预览工作区,完善文档入口、布局及帮助体验。 补充桌面安全发布门禁、开发脚本、使用文档和前后端测试。
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
const source = readFileSync(resolve(__dirname, "./OfficePreviewWorkspace.vue"), "utf8");
|
||||
const hostSource = readFileSync(resolve(__dirname, "../components/OnlyOfficeViewer.vue"), "utf8");
|
||||
|
||||
describe("OfficePreviewWorkspace contract", () => {
|
||||
it("uses a full-page viewer without dialogs, cards, downloads, or browser iframe fallback", () => {
|
||||
expect(source).toContain("OnlyOfficeViewer");
|
||||
expect(source).not.toContain("el-dialog");
|
||||
expect(source).not.toContain("downloadDocumentVersion");
|
||||
expect(source).not.toContain("downloadAttachment");
|
||||
expect(source).not.toContain("<iframe");
|
||||
});
|
||||
|
||||
it("destroys signed configuration on deactivation, server changes, and unmount", () => {
|
||||
expect(source).toContain("onDeactivated");
|
||||
expect(source).toContain("DESKTOP_SERVER_URL_CHANGED_EVENT");
|
||||
expect(source.match(/destroyViewer\(\)/g)?.length).toBeGreaterThanOrEqual(3);
|
||||
expect(hostSource).toContain('frameRef.value.src = "about:blank"');
|
||||
});
|
||||
|
||||
it("closes a desktop transient preview task before falling back to browser history", () => {
|
||||
expect(source).toContain("inject(workspaceTaskControllerKey, null)");
|
||||
expect(source).toContain("workspaceTaskController?.closeTransientTask(route.path)");
|
||||
expect(source).toContain('workspaceTaskController ? "关闭预览并返回" : "返回"');
|
||||
expect(source).toContain("router.back()");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user