mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
Clear up warnings when running test cases.
This commit is contained in:
parent
7636f26c27
commit
f27fa0122d
@ -1,3 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* 编译 components 到 lib 目录
|
||||||
|
*/
|
||||||
const fs = require('fs-extra');
|
const fs = require('fs-extra');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const compiler = require('vue-sfc-compiler');
|
const compiler = require('vue-sfc-compiler');
|
||||||
@ -5,9 +8,16 @@ const libDir = path.resolve(__dirname, '../../lib');
|
|||||||
const srcDir = path.resolve(__dirname, '../../packages');
|
const srcDir = path.resolve(__dirname, '../../packages');
|
||||||
require('shelljs/global');
|
require('shelljs/global');
|
||||||
|
|
||||||
|
// 清空 lib 目录
|
||||||
fs.emptyDirSync(libDir);
|
fs.emptyDirSync(libDir);
|
||||||
|
|
||||||
|
// 复制 packages
|
||||||
fs.copySync(srcDir, libDir);
|
fs.copySync(srcDir, libDir);
|
||||||
|
|
||||||
|
// 编译所有 .vue 文件到 .js
|
||||||
compileVueFiles(libDir);
|
compileVueFiles(libDir);
|
||||||
|
|
||||||
|
// babel 编译
|
||||||
exec('cross-env BABEL_ENV=commonjs babel lib --out-dir lib');
|
exec('cross-env BABEL_ENV=commonjs babel lib --out-dir lib');
|
||||||
|
|
||||||
function compileVueFiles(dir) {
|
function compileVueFiles(dir) {
|
||||||
@ -16,11 +26,16 @@ function compileVueFiles(dir) {
|
|||||||
files.forEach(file => {
|
files.forEach(file => {
|
||||||
const absolutePath = path.resolve(dir, file);
|
const absolutePath = path.resolve(dir, file);
|
||||||
|
|
||||||
|
// 移除 vant-css
|
||||||
if (file.indexOf('vant-css') !== -1) {
|
if (file.indexOf('vant-css') !== -1) {
|
||||||
fs.removeSync(absolutePath);
|
fs.removeSync(absolutePath);
|
||||||
} else if (isDir(absolutePath)) {
|
}
|
||||||
|
// 遍历文件夹
|
||||||
|
else if (isDir(absolutePath)) {
|
||||||
return compileVueFiles(absolutePath);
|
return compileVueFiles(absolutePath);
|
||||||
} else if (/\.vue$/.test(file)) {
|
}
|
||||||
|
// 编译 .vue 文件
|
||||||
|
else if (/\.vue$/.test(file)) {
|
||||||
const source = fs.readFileSync(absolutePath, 'utf-8');
|
const source = fs.readFileSync(absolutePath, 'utf-8');
|
||||||
fs.removeSync(absolutePath);
|
fs.removeSync(absolutePath);
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
exclude: /node_modules|vue-router\/|vue-loader\/|vue-hot-reload-api\//,
|
exclude: /node_modules|vue-router\/|vue-loader\//,
|
||||||
loader: 'babel-loader'
|
loader: 'babel-loader'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -52,7 +52,6 @@
|
|||||||
"babel-cli": "^6.14.0",
|
"babel-cli": "^6.14.0",
|
||||||
"babel-core": "^6.25.0",
|
"babel-core": "^6.25.0",
|
||||||
"babel-loader": "^7.1.1",
|
"babel-loader": "^7.1.1",
|
||||||
"babel-plugin-external-helpers": "^6.22.0",
|
|
||||||
"babel-plugin-module-resolver": "^2.7.1",
|
"babel-plugin-module-resolver": "^2.7.1",
|
||||||
"babel-plugin-syntax-jsx": "^6.18.0",
|
"babel-plugin-syntax-jsx": "^6.18.0",
|
||||||
"babel-plugin-transform-object-rest-spread": "^6.23.0",
|
"babel-plugin-transform-object-rest-spread": "^6.23.0",
|
||||||
@ -103,7 +102,6 @@
|
|||||||
"uppercamelcase": "^3.0.0",
|
"uppercamelcase": "^3.0.0",
|
||||||
"url-loader": "^0.5.9",
|
"url-loader": "^0.5.9",
|
||||||
"vue": "^2.4.2",
|
"vue": "^2.4.2",
|
||||||
"vue-hot-reload-api": "^2.1.0",
|
|
||||||
"vue-html-loader": "^1.2.4",
|
"vue-html-loader": "^1.2.4",
|
||||||
"vue-loader": "^13.0.4",
|
"vue-loader": "^13.0.4",
|
||||||
"vue-markdown-loader": "^2.0.0",
|
"vue-markdown-loader": "^2.0.0",
|
||||||
@ -111,11 +109,9 @@
|
|||||||
"vue-sfc-compiler": "^0.0.1",
|
"vue-sfc-compiler": "^0.0.1",
|
||||||
"vue-style-loader": "^3.0.0",
|
"vue-style-loader": "^3.0.0",
|
||||||
"vue-template-compiler": "^2.4.2",
|
"vue-template-compiler": "^2.4.2",
|
||||||
"vue-template-es2015-compiler": "^1.5.3",
|
|
||||||
"webpack": "^3.5.4",
|
"webpack": "^3.5.4",
|
||||||
"webpack-dev-server": "^2.7.1",
|
"webpack-dev-server": "^2.7.1",
|
||||||
"webpack-merge": "^4.1.0",
|
"webpack-merge": "^4.1.0",
|
||||||
"zan-doc": "0.1.12",
|
"zan-doc": "0.1.12"
|
||||||
"zan-rollup-plugin-alias": "1.0.1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,12 +51,10 @@
|
|||||||
this.wrap = this.$refs.cell.querySelector('.van-cell-wrapper');
|
this.wrap = this.$refs.cell.querySelector('.van-cell-wrapper');
|
||||||
this.leftElm = this.$refs.left;
|
this.leftElm = this.$refs.left;
|
||||||
this.leftWrapElm = this.leftElm.parentNode;
|
this.leftWrapElm = this.leftElm.parentNode;
|
||||||
this.leftDefaultTransform = this.translate3d(-this.leftWidth - 1);
|
|
||||||
this.leftWrapElm.style.webkitTransform = this.leftDefaultTransform;
|
this.leftWrapElm.style.webkitTransform = this.leftDefaultTransform;
|
||||||
|
|
||||||
this.rightElm = this.$refs.right;
|
this.rightElm = this.$refs.right;
|
||||||
this.rightWrapElm = this.rightElm.parentNode;
|
this.rightWrapElm = this.rightElm.parentNode;
|
||||||
this.rightDefaultTransform = this.translate3d(this.rightWidth);
|
|
||||||
this.rightWrapElm.style.webkitTransform = this.rightDefaultTransform;
|
this.rightWrapElm.style.webkitTransform = this.rightDefaultTransform;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -100,14 +98,12 @@
|
|||||||
}, 0);
|
}, 0);
|
||||||
},
|
},
|
||||||
startDrag(evt) {
|
startDrag(evt) {
|
||||||
console.log('startDrag')
|
|
||||||
evt = evt.changedTouches ? evt.changedTouches[0] : evt;
|
evt = evt.changedTouches ? evt.changedTouches[0] : evt;
|
||||||
this.dragging = true;
|
this.dragging = true;
|
||||||
this.start.x = evt.pageX;
|
this.start.x = evt.pageX;
|
||||||
this.start.y = evt.pageY;
|
this.start.y = evt.pageY;
|
||||||
},
|
},
|
||||||
onDrag(evt) {
|
onDrag(evt) {
|
||||||
console.log('onDrag')
|
|
||||||
if (this.opened) {
|
if (this.opened) {
|
||||||
!this.swiping && this.swipeMove(0);
|
!this.swiping && this.swipeMove(0);
|
||||||
this.opened = false;
|
this.opened = false;
|
||||||
@ -132,7 +128,6 @@
|
|||||||
this.swipeMove(offsetLeft);
|
this.swipeMove(offsetLeft);
|
||||||
},
|
},
|
||||||
endDrag() {
|
endDrag() {
|
||||||
console.log('endDrag')
|
|
||||||
if (!this.swiping) return;
|
if (!this.swiping) return;
|
||||||
this.swipeLeaveTransition(this.offsetLeft > 0 ? -1 : 1);
|
this.swipeLeaveTransition(this.offsetLeft > 0 ? -1 : 1);
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ const defaultCallback = action => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const initInstance = () => {
|
const initInstance = () => {
|
||||||
console.log('init instance');
|
|
||||||
instance = new DialogConstructor({
|
instance = new DialogConstructor({
|
||||||
el: document.createElement('div')
|
el: document.createElement('div')
|
||||||
});
|
});
|
||||||
@ -37,7 +36,6 @@ const showNextDialog = () => {
|
|||||||
|
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
if (!instance.value && dialogQueue.length > 0) {
|
if (!instance.value && dialogQueue.length > 0) {
|
||||||
console.log('shift instance');
|
|
||||||
currentDialog = dialogQueue.shift();
|
currentDialog = dialogQueue.shift();
|
||||||
|
|
||||||
const { options } = currentDialog;
|
const { options } = currentDialog;
|
||||||
@ -57,7 +55,6 @@ const showNextDialog = () => {
|
|||||||
|
|
||||||
var DialogBox = options => {
|
var DialogBox = options => {
|
||||||
return new Promise((resolve, reject) => { // eslint-disable-line
|
return new Promise((resolve, reject) => { // eslint-disable-line
|
||||||
console.log('push instance');
|
|
||||||
dialogQueue.push({
|
dialogQueue.push({
|
||||||
options: { ...options },
|
options: { ...options },
|
||||||
callback: options.callback,
|
callback: options.callback,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<van-checkbox-group v-model="result">
|
<van-checkbox-group v-model="result">
|
||||||
<van-checkbox v-for="item in list" :name="item">复选框{{item}}</van-checkbox>
|
<van-checkbox v-for="(item, index) in list" :key="index" :name="item">复选框{{item}}</van-checkbox>
|
||||||
</van-checkbox-group>
|
</van-checkbox-group>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -45,12 +45,12 @@ const webpackConfig = {
|
|||||||
{
|
{
|
||||||
enforce: 'pre',
|
enforce: 'pre',
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
exclude: /node_modules|vue-router\/|vue-loader\/|vue-hot-reload-api\/|docs|test|src\/index|src\/utils|src\/mixins|packages\/swipe/,
|
exclude: /node_modules|vue-router\/|vue-loader\/|docs|test|src\/index|src\/utils|src\/mixins|packages\/swipe/,
|
||||||
use: ['isparta-loader']
|
use: ['isparta-loader']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
exclude: /node_modules|vue-router\/|vue-loader\/|vue-hot-reload-api\//,
|
exclude: /node_modules|vue-router\/|vue-loader\//,
|
||||||
use: ['babel-loader']
|
use: ['babel-loader']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@ import Vue from 'vue';
|
|||||||
|
|
||||||
describe('Dialog', () => {
|
describe('Dialog', () => {
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
const el = document.querySelector('.van-dialog-wrapper');
|
const el = document.querySelector('.van-dialog');
|
||||||
if (!el) return;
|
if (!el) return;
|
||||||
if (el.parentNode) {
|
if (el.parentNode) {
|
||||||
el.parentNode.removeChild(el);
|
el.parentNode.removeChild(el);
|
||||||
@ -20,7 +20,7 @@ describe('Dialog', () => {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(document.querySelector('.van-dialog-wrapper')).to.exist;
|
expect(document.querySelector('.van-dialog')).to.exist;
|
||||||
expect(document.querySelector('.van-dialog__cancel').style.display).to.equal('none');
|
expect(document.querySelector('.van-dialog__cancel').style.display).to.equal('none');
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -34,7 +34,7 @@ describe('Dialog', () => {
|
|||||||
message: 'message'
|
message: 'message'
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(document.querySelector('.van-dialog-wrapper')).to.exist;
|
expect(document.querySelector('.van-dialog')).to.exist;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('create a confirm dialog with callback', (done) => {
|
it('create a confirm dialog with callback', (done) => {
|
||||||
@ -47,7 +47,7 @@ describe('Dialog', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(document.querySelector('.van-dialog-wrapper')).to.exist;
|
expect(document.querySelector('.van-dialog')).to.exist;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
document.querySelector('.van-dialog__cancel').click();
|
document.querySelector('.van-dialog__cancel').click();
|
||||||
expect(dialogAction).to.equal('cancel');
|
expect(dialogAction).to.equal('cancel');
|
||||||
|
12
yarn.lock
12
yarn.lock
@ -547,12 +547,6 @@ babel-plugin-check-es2015-constants@^6.22.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
babel-runtime "^6.22.0"
|
babel-runtime "^6.22.0"
|
||||||
|
|
||||||
babel-plugin-external-helpers@^6.22.0:
|
|
||||||
version "6.22.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/babel-plugin-external-helpers/-/babel-plugin-external-helpers-6.22.0.tgz#2285f48b02bd5dede85175caf8c62e86adccefa1"
|
|
||||||
dependencies:
|
|
||||||
babel-runtime "^6.22.0"
|
|
||||||
|
|
||||||
babel-plugin-module-resolver@^2.7.1:
|
babel-plugin-module-resolver@^2.7.1:
|
||||||
version "2.7.1"
|
version "2.7.1"
|
||||||
resolved "https://registry.yarnpkg.com/babel-plugin-module-resolver/-/babel-plugin-module-resolver-2.7.1.tgz#18be3c42ddf59f7a456c9e0512cd91394f6e4be1"
|
resolved "https://registry.yarnpkg.com/babel-plugin-module-resolver/-/babel-plugin-module-resolver-2.7.1.tgz#18be3c42ddf59f7a456c9e0512cd91394f6e4be1"
|
||||||
@ -7593,9 +7587,3 @@ zan-doc@0.1.12:
|
|||||||
markdown-it "^8.3.1"
|
markdown-it "^8.3.1"
|
||||||
markdown-it-container "^2.0.0"
|
markdown-it-container "^2.0.0"
|
||||||
node-watch "^0.5.5"
|
node-watch "^0.5.5"
|
||||||
|
|
||||||
zan-rollup-plugin-alias@1.0.1:
|
|
||||||
version "1.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/zan-rollup-plugin-alias/-/zan-rollup-plugin-alias-1.0.1.tgz#5004b659cdac960a83d75d4b3f8480b3982fbdd8"
|
|
||||||
dependencies:
|
|
||||||
slash "^1.0.0"
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user