@searsuite/sear-assembly-test
Reusable test platforms, render contexts, and editor fixtures for package consumers.
Create a test Sheet
- interfaceCreateTestSheetOptions
-
Test support contract for CreateTestSheetOptions.
property events?: string[]property plugins?: TestPluginRegistration[]property providers?: TestProviderOverride[]property sheet?: TestSheetDataOptionsproperty viewport?: { height: number; width: number } - interfaceTestPluginRegistration
-
Test support contract for TestPluginRegistration.
- interfaceTestProviderOverride
-
Test support contract for TestProviderOverride.
- interfaceTestSheetCell
-
Test support contract for TestSheetCell.
- interfaceTestSheetDataOptions
-
Test support contract for TestSheetDataOptions.
property cells?: TestSheetCell[]property colCount?: numberproperty colWidth?: numberproperty rowCount?: numberproperty rowHeight?: number - interfaceTestSheetHarness
-
Test support contract for TestSheetHarness.
property readonly commands: SheetCommandBusproperty readonly container: Containerproperty readonly core: SearCoreSheetproperty readonly hitRenderContext: RecordingRenderContextproperty readonly offScreenRenderContext: RecordingRenderContextproperty readonly renderContext: RecordingRenderContextproperty readonly stage: SceneGraph<CellProperties>method destroy(): voidmethod executeTransaction(transaction: Transaction): voidmethod flush(): void - functioncreateTestSheet
-
createTestSheet(options?: CreateTestSheetOptions): TestSheetHarnessBuilds the smallest real Sheet runtime that includes the render pipeline. Browser and scheduling boundaries are replaced with deterministic test implementations.
- functionreplace
-
replace<T>(token: symbol, instance: T): TestProviderOverrideReplaces a binding after default test registrations and before the core resolves.
Test host adapters
- classRecordingRenderContext
-
class RecordingRenderContext extends RenderContextRenderContext implementation that records drawing calls without Canvas pixels.
constructor RecordingRenderContext(): RecordingRenderContextproperty readonly calls: RenderCall[]Recorded render calls captured by RecordingRenderContext.
method addClickEventListener(callBack: (event: EventWithOffset): void): voidAdds the click event listener.
method addEventListener(type: string, callBack: (event: EventWithOffset): void): (): voidAdds the event listener.
method addMouseDownEventListener(callBack: (event: EventWithOffset): void): voidAdds the mouse down event listener.
method addMouseMoveEventListener(callBack: (event: EventWithOffset): void): voidAdds the mouse move event listener.
method addMouseUpEventListener(callBack: (event: EventWithOffset): void): voidAdds the mouse up event listener.
method addResizeListener(_callBack: (): void): voidAdds the resize listener.
method beginPath(): voidBegins a recorded vector path.
method clearRect(x: number, y: number, width: number, height: number): voidRecords a rectangular clear operation.
method clip(): voidClips subsequent recorded operations to the current path.
method cloneNode(): RenderContextCreates an independent copy of a recorded render node.
method closePath(): voidCloses the current recorded vector path.
method createHitNode(): RenderContextCreates the hit node.
methoddrawImage drawImage(image: unknown, x: number, y: number): voiddrawImage(image: unknown, x: number, y: number, width: number, height: number): voiddrawImage(image: unknown, x: number, y: number, width: number, height: number, sx: number, sy: number, sWidth: number, sHeight: number): voidRecords an image draw operation using the supplied source and bounds.
method fill(): voidFills the current path or exposes the node fill paint, depending on the render contract.
method fillText(text: string, x: number, y: number, maxWidth?: number): voidRecords text painting at the supplied position.
method getAttribute(name: string): stringReturns the attribute.
method getImageData(_x: number, _y: number, _width: number, _height: number): { data: [number, number, number, number][]; height: number; width: number }Returns the image data.
method getLineWidth(): numberReturns the line width.
method getMaxLineWidth(): numberReturns the max line width.
method getRasterScale(): numberReturns the raster scale.
method getRenderTarget(): objectReturns the render target.
method getRoot(): EventTargetReturns the root.
method getViewScale(): numberReturns the view scale.
method initialize(_scale?: number): voidInitializes the recording context for a render target.
method lineTo(x: number, y: number): voidAdds a line segment to the current recorded path.
method measureText(text: string): { fontAscent?: number; fontDescent?: number; height: number; width: number }Measures text with the recording context's configured metrics.
method moveTo(x: number, y: number): voidMoves the current recorded path without drawing a segment.
method putImageData(imageData: RenderImageData, x: number, y: number): voidRecords raw pixel data at the supplied position.
method rect(x: number, y: number, width: number, height: number): voidAdds a rectangle to the current recorded path.
method removeClickEventListener(callBack: (event: EventWithOffset): void): voidRemoves the click event listener.
method removeMouseDownEventListener(callBack: (event: EventWithOffset): void): voidRemoves the mouse down event listener.
method removeMouseMoveEventListener(callBack: (event: EventWithOffset): void): voidRemoves the mouse move event listener.
method removeMouseUpEventListener(callBack: (event: EventWithOffset): void): voidRemoves the mouse up event listener.
method removeResizeListener(): voidRemoves the resize listener.
method resetTransform(): voidRestores the recorded transform to the identity matrix.
method resize(width: number, height: number, scale?: number): voidResizes the render target and invalidates dependent frame state.
method restore(): voidRestores the most recently saved render state.
method save(): voidPushes the current render state onto the recording stack.
method setAttribute(name: string, value: string): voidUpdates the attribute.
method setFillStyle(fillStyle: RenderPaint): voidUpdates the fill style.
method setFont(font: string): voidUpdates the font.
method setLineDash(segments: number[]): voidUpdates the line dash.
method setLineWidth(width: number): voidUpdates the line width.
method setStrokeStyle(strokeStyle: RenderPaint): voidUpdates the stroke style.
method setTransform(a: number, b: number, c: number, d: number, e: number, f: number): voidUpdates the transform.
method setViewScale(scale: number): voidUpdates the view scale.
method stroke(): voidStrokes the current recorded path.
method strokeRect(x: number, y: number, width: number, height: number): voidRecords a stroked rectangle operation.
method translate(x: number, y: number): voidOffsets subsequent recorded operations by the supplied vector.
Inherited members 11
Inherited from RenderContext.
- classTestPlatform
-
class TestPlatform extends PlatformDeterministic Platform implementation for harnesses and integration tests.
constructor TestPlatform(): TestPlatformmethod addEventListener(_target: unknown, _type: string, _listener: (event: unknown): void): (): voidRegisters a host event listener and returns an idempotent disposer.
method cancelAnimationFrame(handle: number): voidCancels a previously scheduled host animation frame.
method clearInterval(handle: number): voidCancels a repeating host timer.
method clearTimeout(handle: number): voidCancels a one-shot host timer.
method createId(prefix?: string): stringCreates a deterministic test identifier.
method currentDateTime(): numberReturns the test host wall-clock time as Unix milliseconds.
method destroy(): voidReleases resources owned by TestPlatform.
method flush(): voidRuns all pending one-shot callbacks once, in creation order.
method now(): numberReturns the current test platform time.
method observeResize(_target: unknown, _callback: (size: { height: number; width: number }): void): (): voidObserves host-view size changes and returns an idempotent disposer.
method queueMicrotask(callback: (): void): voidQueues a microtask in the test platform.
method readViewOffset(_target: unknown): PlatformViewOffsetTest targets have no host-space offset unless a fixture overrides it.
method requestAnimationFrame(callback: PlatformFrameRequestCallback): numberSchedules a callback for the next host animation frame.
method setInterval(callback: (): void, _ms: number): numberUpdates the interval.
method setTimeout(callback: (): void, _ms: number): numberUpdates the timeout.
method warn(_message: string, ..._details: unknown[]): voidRecords or emits a platform warning.
- interfaceRenderCall
-
Test support contract for RenderCall.
property args: unknown[]property name: string
No matching API entries.