import { assert, pattern, TESTS, UI } from "commonfabric"; import { hasText } from "../test/vnode-helpers.ts"; import SvgDiagram from "./svg-diagram.tsx"; export default pattern(() => { // Nothing names the subject to draw, so no model request opens and the // diagram is built and read entirely from what it holds on its own. const subject = SvgDiagram({}); const assert_built = assert(() => subject != null); const assert_no_topic = assert(() => subject.topic === ""); const assert_not_pending = assert(() => subject.pending === false); const assert_no_diagram = assert(() => subject.diagram === ""); const assert_generic_heading = assert(() => hasText(subject[UI], "SVG Diagram") ); const assert_no_loader = assert(() => !hasText(subject[UI], "Generating diagram") ); return { [TESTS]: [ { assertion: assert_built }, { assertion: assert_no_topic }, { assertion: assert_not_pending }, { assertion: assert_no_diagram }, { assertion: assert_generic_heading }, { assertion: assert_no_loader }, ], subject, }; });