Skip to content

Commit

Permalink
test(grid): add tests for grid component
Browse files Browse the repository at this point in the history
  • Loading branch information
koca committed Mar 1, 2020
1 parent 57906ae commit 139f163
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
3 changes: 0 additions & 3 deletions packages/kiwi-core/src/Grid/grid.test.js

This file was deleted.

25 changes: 25 additions & 0 deletions packages/kiwi-core/src/Grid/test/Grid.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Grid from '../'
import { render } from '@/packages/kiwi-core/src/test-utils'

const renderComponent = (props) => {
const inlineAttrs = (props && props.inlineAttrs) || ''
const base = {
components: { Grid },
template: `<Grid ${inlineAttrs}>Grid Me</Grid>`,
...props
}
return render(base)
}

it('should render correctly', () => {
const { asFragment } = renderComponent()

expect(asFragment()).toMatchSnapshot()
})

it('should change gap', () => {
const inlineAttrs = 'w="600px" template-columns="repeat(5, 1fr)" gap="6"'
const { asFragment } = renderComponent({ inlineAttrs })

expect(asFragment()).toMatchSnapshot()
})
21 changes: 21 additions & 0 deletions packages/kiwi-core/src/Grid/test/__snapshots__/Grid.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`should change gap 1`] = `
<DocumentFragment>
<div
class="css-1w4meme"
>
Grid Me
</div>
</DocumentFragment>
`;

exports[`should render correctly 1`] = `
<DocumentFragment>
<div
class="css-lgj0h8"
>
Grid Me
</div>
</DocumentFragment>
`;

0 comments on commit 139f163

Please sign in to comment.