Completed
Push — master ( 835745...d5ffb5 )
by Ajeh
29s
created

main.spec.js ➔ ... ➔ ???.methods.check   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
c 0
b 0
f 0
nc 1
dl 0
loc 3
rs 10
nop 0
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