Skip to content

Commit

Permalink
test(varlet-ui): card test change
Browse files Browse the repository at this point in the history
affects: @varlet/ui

add assertion testing to card component
  • Loading branch information
coderYarn authored and haoziqaq committed Oct 16, 2021
1 parent 6bfbbc2 commit b0f00d2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/varlet-ui/src/card/__tests__/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ test('test card props', async () => {
},
})

expect(wrapper.find('img').attributes('style')).toMatch('height: 200px')
expect(wrapper.find('img').attributes('style')).toMatch('object-fit: cover')
expect(wrapper.find('img').attributes('alt')).toMatch('This is an image')
expect(wrapper.find('img').attributes('src')).toMatch('https://varlet.gitee.io/varlet-ui/cat.jpg')
expect(wrapper.find('.var-card__title').text()).toBe('This is Card')
expect(wrapper.find('.var-card__subtitle').text()).toBe('This is subtitle')
expect(wrapper.find('.var-card__description').text()).toBe('This is description')
expect(wrapper.find('.var-card__footer').text()).toBe('text')
expect(wrapper.classes()).toContain('var-elevation--2')
expect(wrapper.html()).toMatchSnapshot()
wrapper.unmount()
})
Expand Down

0 comments on commit b0f00d2

Please sign in to comment.