Skip to content

Commit aca9c76

Browse files
VdustRmarcosmoura
authored andcommitted
test(MdBadge): fix test script (#1736)
1 parent 3c61bcf commit aca9c76

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed
Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11
import mountTemplate from 'test/utils/mountTemplate'
22
import MdBadge from './MdBadge.vue'
3+
import MdBadgeStandalone from './MdBadgeStandalone.vue'
34

45
test('should render the badge', async () => {
5-
const template = '<md-badge>Lorem ipsum</md-badge>'
6+
const template = '<md-badge md-content="3">Lorem ipsum</md-badge>'
7+
const wrapper = await mountTemplate(MdBadge, template)
8+
9+
expect(wrapper.hasClass('md-badge-content')).toBe(true)
10+
const badges = wrapper.find(MdBadgeStandalone)
11+
expect(badges.length).toBe(1)
12+
const badge = badges[0]
13+
expect(badge.hasClass('md-badge')).toBe(true)
14+
const badgeContent = badge.text().trim();
15+
expect(badgeContent).toBe('3')
16+
const slotText = wrapper.text().replace(badgeContent, '').trim()
17+
expect(slotText).toBe('Lorem ipsum')
18+
})
19+
20+
test('should render the badge', async () => {
21+
const template = '<md-badge md-content="3"></md-badge>'
622
const wrapper = await mountTemplate(MdBadge, template)
723

824
expect(wrapper.hasClass('md-badge')).toBe(true)
9-
expect(wrapper.text()).toBe('Lorem ipsum')
25+
expect(wrapper.text().trim()).toBe('3')
1026
})

0 commit comments

Comments
 (0)