Skip to content

Commit

Permalink
fix: allow size to be overriden
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett committed Jan 2, 2024
1 parent f950fe1 commit ed2c0e3
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/test-renderer/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ const act = _act as unknown as Act
const create = async (element: React.ReactNode, options?: Partial<CreateOptions>): Promise<Renderer> => {
const canvas = createCanvas(options)

let size

if (typeof options !== 'undefined' && typeof options.width !== 'undefined' && typeof options.height !== 'undefined') {
size = { width: options.width, height: options.height, top: 0, left: 0 }
}

const _root = createRoot(canvas).configure({
frameloop: 'never',
// TODO: remove and use default behavior
size: {
width: options?.width ?? 1280,
height: options?.height ?? 800,
top: 0,
left: 0,
updateStyle: typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement,
},
...options,
size,
events: undefined,
})
const _store = mockRoots.get(canvas)!.store
Expand Down

0 comments on commit ed2c0e3

Please sign in to comment.