UNPKG

@gravity-ui/graph

Version:

Modern graph editor component

39 lines (38 loc) 1.37 kB
import { Graph } from "../graph"; import { ECanChangeBlockGeometry } from "./settings"; describe("Settings store", () => { let graph; let store; beforeEach(() => { graph = new Graph({}); store = graph.rootStore.settings; }); it("should be defined", () => { expect(store).toBeDefined(); }); it("Should init wit default settings", () => { expect(store.asConfig).toEqual({ canDragCamera: true, canZoomCamera: true, canDuplicateBlocks: false, canChangeBlockGeometry: ECanChangeBlockGeometry.NONE, canCreateNewConnections: false, showConnectionArrows: true, scaleFontSize: 1, useBezierConnections: true, bezierConnectionDirection: "horizontal", useBlocksAnchors: true, connectivityComponentOnClickRaise: true, showConnectionLabels: false, blockComponents: {}, }); }); it("Should get config via key", () => { expect(store.getConfigFlag("canDuplicateBlocks")).toBe(false); }); it("Should set config via key", () => { expect(store.getConfigFlag("canDuplicateBlocks")).toBe(false); store.setConfigFlag("canDuplicateBlocks", true); expect(store.getConfigFlag("canDuplicateBlocks")).toBe(true); }); });