Skip to content

Commit

Permalink
test: fix popup and top-tips test.
Browse files Browse the repository at this point in the history
  • Loading branch information
tianyong90 committed Sep 10, 2018
1 parent 73df368 commit fc53fcc
Show file tree
Hide file tree
Showing 6 changed files with 1,608 additions and 1,629 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Expand Up @@ -23,7 +23,7 @@ jobs:
key: v1-dependencies-{{ checksum "package.json" }}

# run tests!
- run: yarn test
- run: yarn test -- --coverage

# update codecov stats
- run: ./node_modules/.bin/codecov
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -37,8 +37,8 @@
"build:release": "npm run build:entry && npm run build:component && npm run build:lib",
"dev": "npm run build:entry && webpack-dev-server --inline --config build/webpack.dev.conf.js",
"dev:docs": "webpack-dev-server --inline --config build/webpack.docsdev.conf.js",
"test": "jest --config=test/unit/jest.conf.js --coverage --runInBand",
"test:watch": "jest --config=test/unit/jest.conf.js --coverage --watchAll",
"test": "jest --config=test/unit/jest.conf.js --runInBand",
"test:watch": "jest --config=test/unit/jest.conf.js --watchAll",
"coverage": "opener test/unit/coverage/lcov-report/index.html",
"release": "node build/release.js"
},
Expand Down
1 change: 1 addition & 0 deletions test/unit/jest.conf.js
Expand Up @@ -27,6 +27,7 @@ module.exports = {
collectCoverageFrom: [
'packages/**/*.{js,vue}',
'!packages/mixins/**/*.js',
'!**/packages/style/**',
'!**/node_modules/**',
'!**/lazyload/**'
]
Expand Down
6 changes: 3 additions & 3 deletions test/unit/specs/popup.spec.js
@@ -1,4 +1,4 @@
import { shallowMount } from '@vue/test-utils'
import { shallowMount, mount } from '@vue/test-utils'
import Popup from '@/popup'

describe('popup', () => {
Expand All @@ -8,7 +8,7 @@ describe('popup', () => {
})

test('create', () => {
wrapper = shallowMount(Popup, {
wrapper = mount(Popup, {
propsData: {}
})

Expand All @@ -17,7 +17,7 @@ describe('popup', () => {
})

test('create a popup that is visible', () => {
wrapper = shallowMount(Popup, {
wrapper = mount(Popup, {
attachToDocument: true,
propsData: {
visible: true
Expand Down
15 changes: 5 additions & 10 deletions test/unit/specs/top-tips.spec.js
@@ -1,4 +1,4 @@
import { shallowMount, createLocalVue } from '@vue/test-utils'
import { mount, shallowMount, createLocalVue } from '@vue/test-utils'
import TopTipsApi from '@/top-tips'
import TopTips from '@/top-tips/top-tips.vue'

Expand Down Expand Up @@ -66,21 +66,16 @@ describe('top-tips component', () => {
wrapper && wrapper.destroy()
})

test('create', (done) => {
wrapper = shallowMount(TopTips, {
test('create', () => {
wrapper = mount(TopTips, {
attachToDocument: true,
propsData: {
visible: true
}
})

// TODO
wrapper.vm.$nextTick(() => {
expect(wrapper.name()).toBe('wv-top-tips')
// expect(wrapper.classes()).toContain('weui-toptips')

done()
})
expect(wrapper.name()).toBe('wv-top-tips')
expect(wrapper.classes()).toContain('weui-toptips')
})

test('render message correctlly', () => {
Expand Down

0 comments on commit fc53fcc

Please sign in to comment.