Skip to content

Commit 09b50c4

Browse files
committed
Update test for alert visible buttons.
1 parent 78ece5b commit 09b50c4

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

test/unit/specs/plugin/behaviour-for-alert.spec.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('Calling "alert()"', function () {
3434
})
3535
})
3636

37-
describe('#alert(), Clicking "ok"', function () {
37+
describe('with #alert(), Clicking "ok"', function () {
3838
// this.timeout(3000);
3939
beforeEach(HOOKS.sanitizeAndPrepareWindow)
4040

@@ -51,11 +51,18 @@ describe('#alert(), Clicking "ok"', function () {
5151

5252
describe('with #alert(), user ', function () {
5353
// this.timeout(3000);
54-
beforeEach(HOOKS.sanitizeAndPrepareWindow)
55-
56-
it('Should not see cancel button', function () {
54+
before(HOOKS.sanitizeAndPrepareWindow)
55+
before(function(){
5756
window.vm.triggerAlert()
57+
})
5858

59+
it('Should see ok button', function () {
60+
Vue.nextTick(() => {
61+
assert.equal(getElem('dg-btn--ok').length, 1)
62+
})
63+
})
64+
65+
it('Should not see cancel button', function () {
5966
Vue.nextTick(() => {
6067
assert.equal(getElem('dg-btn--cancel').length, 0)
6168
})

test/unit/specs/plugin/behaviour-for-confirm.spec.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,25 @@ describe('Calling "confirm()"', function () {
3232
}
3333
})
3434
})
35+
})
36+
37+
38+
describe('with #confirm(), user ', function () {
39+
this.timeout(100);
40+
before(HOOKS.sanitizeAndPrepareWindow)
41+
before(function () {
42+
window.vm.triggerConfirm()
43+
})
44+
45+
it('Should see ok button', function () {
46+
Vue.nextTick(() => {
47+
assert.equal(getElem('dg-btn--ok').length, 1)
48+
})
49+
})
50+
51+
it('Should see cancel button', function () {
52+
Vue.nextTick(() => {
53+
assert.equal(getElem('dg-btn--cancel').length, 1)
54+
})
55+
})
3556
})

test/unit/utilities/initializers.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
* Created by Emmy on 10/11/2017.
33
*/
44

5-
import Vue from 'vue'
65
import Plugin from '../../../src/plugin/js/index'
76
import {clickNode} from '../../../src/plugin/js/utilities'
87
import {getElem} from './helpers'
98
import {createLocalVue} from 'vue-test-utils'
10-
import Promise from 'promise-polyfill'
119

1210
export function setupVmWithLocalVue() {
1311
let LocalVue = createLocalVue()

0 commit comments

Comments
 (0)