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

tests/plugin/main.spec.js   A

Complexity

Total Complexity 13
Complexity/F 1

Size

Lines of Code 57
Function Count 13

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 0
wmc 13
c 2
b 0
f 0
nc 1
mnd 0
bc 13
fnc 13
dl 0
loc 57
rs 10
bpm 1
cpm 1
noi 0

3 Functions

Rating   Name   Duplication   Size   Complexity  
A main.spec.js ➔ describe(ꞌPlugin Installedꞌ) 0 8 1
A main.spec.js ➔ describe(ꞌPlugin installerꞌ) 0 5 1
A main.spec.js ➔ describe(ꞌPlugin Availableꞌ) 0 18 1
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