Completed
Push — master ( 111ea3...33738e )
by Ajeh
31s
created

main.spec.js ➔ ... ➔ describe(ꞌ#Availableꞌ)   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 36

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
dl 0
loc 36
rs 8.8571
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', 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
})