Total Complexity | 7 |
Complexity/F | 1 |
Lines of Code | 42 |
Function Count | 7 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | /** |
||
5 | import Plugin from '../../../../src/plugin/js/index' |
||
6 | import {assert, expect} from 'chai' |
||
|
|||
7 | import Vue from 'vue' |
||
8 | import Promise from 'promise-polyfill' |
||
9 | |||
10 | Vue.config.productionTip = false |
||
11 | let vm = setupVue() |
||
12 | |||
13 | describe('Calling "$dialog.alert()"', function () { |
||
14 | it('Should return a promise', function () { |
||
15 | vm.checkAlert() |
||
16 | }) |
||
17 | }) |
||
18 | |||
19 | describe('Calling "$dialog.confirm()"', function () { |
||
20 | it('Should return a promise', function () { |
||
21 | vm.checkConfirm() |
||
22 | }) |
||
23 | }) |
||
24 | |||
25 | console.log(document.body.innerHTML) |
||
26 | function setupVue() { |
||
27 | Vue.use(Plugin) |
||
28 | |||
29 | let div = document.createElement('div') |
||
30 | div.id = 'app' |
||
31 | document.body.appendChild(div) |
||
32 | |||
33 | return new Vue({ |
||
34 | $el: '#app', |
||
35 | methods: { |
||
36 | checkAlert(){ |
||
37 | let dg = this.$dialog.alert('Simple Alert') |
||
38 | expect(dg).to.be.instanceOf(Promise) |
||
39 | }, |
||
40 | checkConfirm(){ |
||
41 | let dg = this.$dialog.confirm('Please confirm') |
||
42 | expect(dg).to.be.instanceOf(Promise) |
||
43 | } |
||
44 | } |
||
45 | }) |
||
46 | } |