(opts: MockNodeModelOpts)
| 13 | }; |
| 14 | |
| 15 | export function makeMockNodeModel(opts: MockNodeModelOpts): NodeModel { |
| 16 | const isFocusedAtom = atom(true); |
| 17 | const isMagnifiedAtom = atom(false); |
| 18 | |
| 19 | return { |
| 20 | additionalProps: atom({} as any), |
| 21 | innerRect: atom(opts.innerRect ?? { width: "1000px", height: "640px" }), |
| 22 | blockNum: atom(1), |
| 23 | numLeafs: atom(opts.numLeafs ?? 1), |
| 24 | nodeId: opts.nodeId, |
| 25 | blockId: opts.blockId, |
| 26 | addEphemeralNodeToLayout: () => {}, |
| 27 | animationTimeS: atom(0), |
| 28 | isResizing: atom(false), |
| 29 | isFocused: isFocusedAtom, |
| 30 | isMagnified: isMagnifiedAtom, |
| 31 | anyMagnified: atom((get) => get(isMagnifiedAtom)), |
| 32 | isEphemeral: atom(false), |
| 33 | ready: atom(true), |
| 34 | disablePointerEvents: atom(false), |
| 35 | toggleMagnify: () => { |
| 36 | globalStore.set(isMagnifiedAtom, !globalStore.get(isMagnifiedAtom)); |
| 37 | }, |
| 38 | focusNode: () => { |
| 39 | globalStore.set(isFocusedAtom, true); |
| 40 | }, |
| 41 | onClose: () => {}, |
| 42 | dragHandleRef: { current: null }, |
| 43 | displayContainerRef: { current: null }, |
| 44 | }; |
| 45 | } |
no test coverage detected