|
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', function () { |
|
10
|
|
|
describe('#installer', function () { |
|
11
|
|
|
it('"Plugin.install" Should be a function', function () { |
|
12
|
|
|
should(Plugin.install).be.a.Function() |
|
13
|
|
|
}) |
|
14
|
|
|
}) |
|
15
|
|
|
|
|
16
|
|
|
describe('#Installed', function () { |
|
17
|
|
|
it('Plugin Should be installed', function () { |
|
18
|
|
|
const Vue = require('vue').default |
|
19
|
|
|
Vue.use(Plugin) |
|
20
|
|
|
|
|
21
|
|
|
assert.property(Vue, 'dialog') |
|
22
|
|
|
}) |
|
23
|
|
|
}) |
|
24
|
|
|
|
|
25
|
|
|
describe('#Available', function () { |
|
26
|
|
|
it('"$dialog" Should be a available on the created, mounted hooks', function () { |
|
27
|
|
|
const Vue = require('vue').default |
|
28
|
|
|
Vue.use(Plugin) |
|
29
|
|
|
|
|
30
|
|
|
new Vue({ |
|
31
|
|
|
created(){ |
|
32
|
|
|
assert.property(this, '$dialog') |
|
33
|
|
|
}, |
|
34
|
|
|
mounted(){ |
|
35
|
|
|
assert.property(this, '$dialog') |
|
36
|
|
|
}, |
|
37
|
|
|
render(h){ |
|
38
|
|
|
return h('p', {id: 'test'}, 'test') |
|
39
|
|
|
} |
|
40
|
|
|
}).$mount() |
|
41
|
|
|
}) |
|
42
|
|
|
|
|
43
|
|
|
it('"$dialog" Should be a available in component methods', function () { |
|
44
|
|
|
const Vue = require('vue').default |
|
45
|
|
|
Vue.use(Plugin) |
|
46
|
|
|
|
|
47
|
|
|
let vm = new Vue({ |
|
48
|
|
|
methods: { |
|
49
|
|
|
check(){ |
|
50
|
|
|
assert.property(this, '$dialog') |
|
51
|
|
|
} |
|
52
|
|
|
}, |
|
53
|
|
|
render(h){ |
|
54
|
|
|
return h('p', {id: 'test'}, 'test') |
|
55
|
|
|
} |
|
56
|
|
|
}).$mount() |
|
57
|
|
|
|
|
58
|
|
|
vm.check() |
|
59
|
|
|
}) |
|
60
|
|
|
}) |
|
61
|
|
|
|
|
62
|
|
|
}) |