@jsxui/layout-snapshot
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

@jsxui/layout-snapshot

Jest snapshot matcher to generate screenshots of your layout tests.

Install

yarn add @jsxui/layout-snapshot
npm install @jsxui/layout-snapshot

Usage

import { computeLayout, createColumn, createNode } from '@jsxui/layout'
import { toMatchLayoutSnapshot } from '@jsxui/layout-snapshot'

expect.extend({ toMatchLayoutSnapshot })

test('positions Column children along vertical axis', () => {
  const node1 = createNode({ width: 2, height: 2 })
  const node2 = createNode({ width: 4, height: 1 })
  const column = createColumn({
    columns: 1,
    rows: 4,
    children: [node1, node2],
  })
  const { layout } = computeLayout(column)

  expect(layout).toMatchLayoutSnapshot()
})

Development

If you are experiencing issues installing the package for development on your machine, it's most likely due to the canvas dependency this package relies on. Check the installation instructions here to make sure you have the appropriate libaries installed.

Readme

Keywords

none

Package Sidebar

Install

npm i @jsxui/layout-snapshot

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

3.48 kB

Total Files

4

Last publish

Collaborators

  • souporserious