Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:test_tube: Type diagram preview regression fixtures https://github.com/siyuan-note/siyuan/issues/19995

Danielc7948483c6d5
diff --git a/app/src/protyle/preview/diagram.test.ts b/app/src/protyle/preview/diagram.test.ts
index d4a1f79e20..7a1eb6a102 100644
--- a/app/src/protyle/preview/diagram.test.ts
+++ b/app/src/protyle/preview/diagram.test.ts
@@ -60,12 +60,12 @@ for (const scenario of [
for (const subtype of ["mermaid", "echarts"]) {
for (const background of ["rgb(30, 30, 30)", "rgb(255, 255, 255)"]) {
test(`${subtype} preview uses the editor background ${background}`, async () => {
- const editor = {parentElement: null};
+ const editor = {parentElement: null as HTMLElement};
const diagram = {parentElement: editor, getAttribute: () => subtype, querySelector: () => render};
- const clone = {style: {}, querySelectorAll: () => [], setAttribute: () => {}};
+ const clone = {style: {}, querySelectorAll: (): Element[] => [], setAttribute: () => {}};
const render = {
viewBox: {baseVal: {width: 300, height: 150}}, cloneNode: () => clone,
- querySelectorAll: () => [], getBoundingClientRect: () => ({width: 300, height: 150}),
+ querySelectorAll: (): Element[] => [], getBoundingClientRect: () => ({width: 300, height: 150}),
};
let rasterBackground: string;
const exports = {} as {previewDiagram: (element: unknown) => Promise<void>};