mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
test(NSkeleton): add test (#804)
This commit is contained in:
parent
648392b8c4
commit
9c187b9c1c
58
src/skeleton/tests/Skeleton.spec.tsx
Normal file
58
src/skeleton/tests/Skeleton.spec.tsx
Normal file
@ -0,0 +1,58 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { NSkeleton } from '../index'
|
||||
|
||||
describe('n-skeleton', () => {
|
||||
it('should work with import on demand', () => {
|
||||
mount(NSkeleton)
|
||||
})
|
||||
|
||||
it('should work with `text` prop', async () => {
|
||||
const wrapper = mount(NSkeleton, {
|
||||
props: {
|
||||
text: true
|
||||
}
|
||||
})
|
||||
expect(wrapper.find('.n-skeleton').attributes('style')).toMatchSnapshot()
|
||||
})
|
||||
|
||||
it('should work with box', async () => {
|
||||
const wrapper = mount(NSkeleton)
|
||||
expect(wrapper.find('.n-skeleton').attributes('style')).toMatchSnapshot()
|
||||
})
|
||||
|
||||
it('should work with `sharp` prop', async () => {
|
||||
const wrapper = mount(NSkeleton, {
|
||||
props: {
|
||||
sharp: false
|
||||
}
|
||||
})
|
||||
expect(wrapper.find('.n-skeleton').attributes('style')).toMatchSnapshot()
|
||||
})
|
||||
|
||||
it('should work with `round` prop', async () => {
|
||||
const wrapper = mount(NSkeleton, {
|
||||
props: {
|
||||
round: true
|
||||
}
|
||||
})
|
||||
expect(wrapper.find('.n-skeleton').attributes('style')).toMatchSnapshot()
|
||||
})
|
||||
|
||||
it('should work with `circle` prop', async () => {
|
||||
const wrapper = mount(NSkeleton, {
|
||||
props: {
|
||||
circle: true
|
||||
}
|
||||
})
|
||||
expect(wrapper.find('.n-skeleton').attributes('style')).toMatchSnapshot()
|
||||
})
|
||||
|
||||
it('should work with `repeat` prop', async () => {
|
||||
const wrapper = mount(NSkeleton, {
|
||||
props: {
|
||||
repeat: 2
|
||||
}
|
||||
})
|
||||
expect(wrapper.findAll('.n-skeleton').length).toBe(2)
|
||||
})
|
||||
})
|
11
src/skeleton/tests/__snapshots__/Skeleton.spec.tsx.snap
Normal file
11
src/skeleton/tests/__snapshots__/Skeleton.spec.tsx.snap
Normal file
@ -0,0 +1,11 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`n-skeleton should work with \`circle\` prop 1`] = `"border-radius: 50%; --bezier: cubic-bezier(.4, 0, .2, 1); --color-start: #eee; --color-end: #ddd;"`;
|
||||
|
||||
exports[`n-skeleton should work with \`round\` prop 1`] = `"border-radius: 4096px; --bezier: cubic-bezier(.4, 0, .2, 1); --color-start: #eee; --color-end: #ddd;"`;
|
||||
|
||||
exports[`n-skeleton should work with \`sharp\` prop 1`] = `"border-radius: 3px; --bezier: cubic-bezier(.4, 0, .2, 1); --color-start: #eee; --color-end: #ddd;"`;
|
||||
|
||||
exports[`n-skeleton should work with \`text\` prop 1`] = `"display: inline-block; vertical-align: -0.125em; --bezier: cubic-bezier(.4, 0, .2, 1); --color-start: #eee; --color-end: #ddd;"`;
|
||||
|
||||
exports[`n-skeleton should work with box 1`] = `"--bezier: cubic-bezier(.4, 0, .2, 1); --color-start: #eee; --color-end: #ddd;"`;
|
Loading…
Reference in New Issue
Block a user