1
|
|
|
/** |
2
|
|
|
* Created by Emmy on 10/8/2017. |
3
|
|
|
*/ |
4
|
|
|
|
5
|
|
|
import Plugin from '../../src/plugin/js/index' |
6
|
|
|
import should from 'should' |
7
|
|
|
import {assert} from 'chai' |
8
|
|
|
|
9
|
|
|
describe('Plugin installer', function () { |
10
|
|
|
it('"Plugin.install" Should be a function', function () { |
11
|
|
|
should(Plugin.install).be.a.Function() |
12
|
|
|
}) |
13
|
|
|
}) |
14
|
|
|
|
15
|
|
|
describe('Plugin Installed', function () { |
16
|
|
|
it('Plugin Should be installed', function () { |
17
|
|
|
const Vue = require('vue').default |
18
|
|
|
Vue.use(Plugin) |
19
|
|
|
|
20
|
|
|
assert.property(Vue, 'dialog') |
21
|
|
|
}) |
22
|
|
|
}) |
23
|
|
|
|
24
|
|
|
describe('Plugin Available', function () { |
25
|
|
|
it('"$dialog" Should be a available on the created, mounted hooks', function () { |
26
|
|
|
const Vue = require('vue').default |
27
|
|
|
Vue.use(Plugin) |
28
|
|
|
|
29
|
|
|
new Vue({ |
30
|
|
|
created(){ |
31
|
|
|
assert.property(this, '$dialog') |
32
|
|
|
}, |
33
|
|
|
mounted(){ |
34
|
|
|
assert.property(this, '$dialog') |
35
|
|
|
}, |
36
|
|
|
render(h){ |
37
|
|
|
return h('p', {id: 'test'}, 'test') |
38
|
|
|
} |
39
|
|
|
}).$mount() |
40
|
|
|
}) |
41
|
|
|
}) |
42
|
|
|
|
43
|
|
|
describe('Plugin Available', function () { |
44
|
|
|
it('"$dialog" Should be a available in component methods', function () { |
45
|
|
|
const Vue = require('vue').default |
46
|
|
|
Vue.use(Plugin) |
47
|
|
|
|
48
|
|
|
let vm = new Vue({ |
49
|
|
|
methods: { |
50
|
|
|
check(){ |
51
|
|
|
assert.property(this, '$dialog') |
52
|
|
|
} |
53
|
|
|
}, |
54
|
|
|
render(h){ |
55
|
|
|
return h('p', {id: 'test'}, 'test') |
56
|
|
|
} |
57
|
|
|
}).$mount() |
58
|
|
|
|
59
|
|
|
vm.check() |
60
|
|
|
}) |
61
|
|
|
}) |
62
|
|
|
|