Merge pull request #105 from unix/test

test(card): add testcase
This commit is contained in:
witt
2020-04-16 10:33:57 +08:00
committed by GitHub
4 changed files with 2044 additions and 2 deletions

8
.codecov.yml Normal file
View File

@@ -0,0 +1,8 @@
codecov:
require_ci_to_pass: yes
comment:
layout: "reach, diff, flags, files"
behavior: default
require_changes: false
branches:
- "master"

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,48 @@
import React from 'react'
import { mount, render } from 'enzyme'
import { Card } from '../../index'
describe('Card', () => {
it('should render correctly', () => {
const wrapper = mount(<Card>card</Card>)
expect(() => wrapper.unmount()).not.toThrow()
})
it('should support shadow and hoverable', () => {
const wrapper = render(
<div>
<Card hoverable>card</Card>
<Card shadow>card</Card>
<Card shadow hoverable>card</Card>
</div>
)
expect(wrapper).toMatchSnapshot()
})
it('should support card types', () => {
const wrapper = mount(
<div>
<Card type="secondary">card</Card>
<Card type="success">card</Card>
<Card type="violet">card</Card>
<Card type="lite">card</Card>
<Card type="cyan">card</Card>
<Card type="secondary">card</Card>
<Card type="warning">card</Card>
</div>
)
expect(() => wrapper.unmount()).not.toThrow()
})
it('should render correctly when nested', () => {
const wrapper = render(
<Card>
<Card shadow>
<Card>card</Card>
</Card>
</Card>
)
expect(wrapper).toMatchSnapshot()
})
})

View File

@@ -1,5 +1,3 @@
import Card from './card'
import { CardProps } from './card'
export type Props = CardProps
export default Card