This repository was archived by the owner on Jun 10, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 101
/
Copy pathVueMdc.spec.js
79 lines (65 loc) · 1.37 KB
/
VueMdc.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import VueMdc from 'src'
import * as all from 'src'
import { Vue } from '../helpers/utils'
function comp (Vue, name) {
return function () {
should.exist(Vue.component(name))
}
}
function dir (Vue, name) {
return function () {
should.exist(Vue.directive(name))
}
}
const components = [
'Button',
'Card',
'CardActions',
'CardHorizontalBlock',
'CardMedia',
'CardPrimary',
'CardSubtitle',
'CardSupportingText',
'CardTitle',
'Checkbox',
'Dialog',
'DialogHeaderTitle',
'Drawer',
'DrawerHeader',
'DrawerNav',
'DrawerNavItem',
'Fab',
'List',
'ListDivider',
'ListItem',
'Toolbar',
'ToolbarRow',
'ToolbarSection',
]
describe('VueMdc', function () {
it('exporting all components', function () {
Object.keys(all).should.eql(
['version', ...components, 'ripple', 'default']
)
})
describe('Register components', function () {
const Vue1 = Vue.extend()
components.forEach(name => {
Vue1.use(VueMdc)
it(`registers Mdc${name}`, comp(Vue1, `Mdc${name}`))
})
it('registers v-ripple', dir(Vue1, 'ripple'))
})
describe('Prefixes', function () {
const Vue2 = Vue.extend()
before(function () {
VueMdc.installed = false
Vue2.use(VueMdc, {
prefix: 'Ui',
})
})
components.forEach(name => {
it(`registers Ui${name}`, comp(Vue2, `Ui${name}`))
})
})
})