Skip to content

Commit a53aff6

Browse files
committed
feat(MdBadge): add prop validation
1 parent e136096 commit a53aff6

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/components/MdBadge/MdBadge.test.js

-7
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,3 @@ test('should render the badge', async () => {
88
expect(wrapper.hasClass('md-badge')).toBe(true)
99
expect(wrapper.text()).toBe('Lorem ipsum')
1010
})
11-
12-
test('should render the theme class', async () => {
13-
const template = '<md-badge md-theme="alt">Lorem ipsum</md-badge>'
14-
const wrapper = await mountTemplate(MdBadge, template)
15-
16-
expect(wrapper.hasClass('md-theme-alt')).toBe(true)
17-
})

src/components/MdBadge/MdBadge.vue

+6-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
<script>
1616
import MdComponent from 'core/MdComponent'
17+
import MdPropValidator from 'core/utils/MdPropValidator'
1718
1819
import MdBadgeStandalone from './MdBadgeStandalone'
1920
@@ -26,7 +27,11 @@
2627
mdContent: [String, Number],
2728
mdPosition: {
2829
type: String,
29-
default: 'top'
30+
default: 'top',
31+
...MdPropValidator('md-position', [
32+
'top',
33+
'bottom'
34+
])
3035
},
3136
mdDense: Boolean
3237
},

0 commit comments

Comments
 (0)