Skip to content

Commit 455c051

Browse files
committed
Fix tests
1 parent 32ea7b1 commit 455c051

File tree

4 files changed

+36
-27
lines changed

4 files changed

+36
-27
lines changed

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"dev": "node node_modules/cross-env/dist/bin/cross-env NODE_ENV=development webpack-dev-server --inline --progress --open --config webpack.docs.config.js ",
1111
"docs": "node node_modules/cross-env/dist/bin/cross-env NODE_ENV=production webpack --config=webpack.docs.config.js --progress --hide-modules",
1212
"build": "node node_modules/cross-env/dist/bin/cross-env NODE_ENV=production webpack --config=webpack.config.js --progress --hide-modules",
13-
"watch-test": "node node_modules/cross-env/dist/bin/cross-env NODE_ENV=test BABEL_ENV=test ./node_modules/karma/bin/karma start test/unit/karma.config.js --delay",
13+
"test:watch": "node node_modules/cross-env/dist/bin/cross-env NODE_ENV=test BABEL_ENV=test ./node_modules/karma/bin/karma start test/unit/karma.config.js --delay",
1414
"test": "node node_modules/cross-env/dist/bin/cross-env NODE_ENV=test BABEL_ENV=test ./node_modules/karma/bin/karma start test/unit/karma.config.js --single-run --delay"
1515
},
1616
"repository": {

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

+25-25
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,43 @@
44

55
import Vue from 'vue'
66
import Promise from 'promise-polyfill'
7-
import {assert, expect} from 'chai'
7+
import { assert, expect } from 'chai'
88
import * as HOOKS from '../../utilities/hooks'
9-
import {nodeLength} from '../../utilities/helpers'
9+
import { nodeLength } from '../../utilities/helpers'
1010

1111
Vue.config.productionTip = false
1212

1313
describe('Calling "alert()"', function () {
14-
let dg
14+
let dg
1515

16-
before(HOOKS.sanitizeAndPrepareWindow)
17-
before(function (done) {
18-
dg = window.vm.triggerAlert()
19-
Vue.nextTick(done) // be sure done has updated before proceeding
20-
})
16+
before(HOOKS.sanitizeAndPrepareWindow)
17+
before(function (done) {
18+
dg = window.vm.triggerAlert()
19+
Vue.nextTick(done) // be sure done has updated before proceeding
20+
})
2121

22-
it('Should return a promise', function () {
23-
expect(dg).to.be.instanceOf(Promise)
24-
})
22+
it('Should return a promise', function () {
23+
expect(dg).to.be.instanceOf(Promise)
24+
})
2525

26-
it('Should make the dialog visible', function () {
27-
assert.strictEqual(nodeLength('.dg-container'), 1)
28-
})
26+
it('Should make the dialog visible', function () {
27+
assert.strictEqual(nodeLength('.dg-container'), 1)
28+
})
2929

30-
it('Should make the ok button visible', function () {
31-
assert.strictEqual(nodeLength('.dg-btn--ok'), 1)
32-
})
30+
it('Should make the ok button visible', function () {
31+
assert.strictEqual(nodeLength('.dg-btn--ok'), 1)
32+
})
3333

34-
it('Should exclude the cancel button', function () {
35-
assert.strictEqual(nodeLength('.dg-btn--cancel'), 0)
36-
})
34+
it('Should exclude the cancel button', function () {
35+
assert.strictEqual(nodeLength('.dg-btn--cancel'), 0)
36+
})
3737
})
3838

3939
describe('Clicking "ok" on #alert()', function () {
40-
before(HOOKS.sanitizeAndPrepareWindow)
40+
before(HOOKS.sanitizeAndPrepareWindow)
4141

42-
it('Should resolve the promise', function (done) {
43-
window.vm.triggerAlert().then(() => {done()}) // expected
44-
Vue.nextTick(() => window.vm.clickDialogBtn('ok'))
45-
})
42+
it('Should resolve the promise', function (done) {
43+
window.vm.triggerAlert().then(() => { done() }) // expected
44+
Vue.nextTick(() => window.vm.clickDialogBtn('ok'))
45+
})
4646
})

Diff for: test/unit/utilities/initializers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Created by Emmy on 10/11/2017.
33
*/
44

5-
import Plugin from '../../../src/plugin/js/index'
5+
import Plugin from '../../../src/plugin/js'
66
import { clickNode } from '../../../src/plugin/js/utilities'
77
import { getElem } from './helpers'
88
import { createLocalVue } from '@vue/test-utils'

Diff for: webpack.test.config.js

+9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55

66
const baseConfig = require('./webpack.base.config')
77

8+
baseConfig.module.rules = baseConfig.module.rules.map((rule) => {
9+
if (rule.test.toString() === '/\\.vue$/') {
10+
rule.options = rule.options || {}
11+
rule.options.optimizeSSR = false
12+
}
13+
14+
return rule
15+
})
16+
817
module.exports = Object.assign({}, baseConfig, {
918
target: 'node',
1019
devtool: 'inline-cheap-module-source-map'

0 commit comments

Comments
 (0)