mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-11-29 18:48:32 +08:00
update: [BUG] wired bug for 'validator'
This commit is contained in:
parent
9ec6439cca
commit
e4d70faf2e
3
.gitignore
vendored
3
.gitignore
vendored
@ -56,4 +56,5 @@ typings/
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
|
||||
.idea
|
||||
.DS_Store
|
||||
|
20
package.json
20
package.json
@ -5,7 +5,7 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "NODE_ENV=development webpack-dev-server --open --hot",
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"test": "karma start test/karma.conf.js --single-run",
|
||||
"lint": "eslint -c ./.eslintrc --fix --ext .js ./src/",
|
||||
"lint:style": "stylelint \"./src/**/*.less\" --syntax less"
|
||||
},
|
||||
@ -30,17 +30,35 @@
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-helper-vue-jsx-merge-props": "^2.0.2",
|
||||
"babel-loader": "^7.1.2",
|
||||
"babel-plugin-istanbul": "^4.1.1",
|
||||
"babel-plugin-syntax-jsx": "^6.18.0",
|
||||
"babel-plugin-transform-vue-jsx": "^3.5.0",
|
||||
"babel-preset-env": "^1.6.0",
|
||||
"chai": "^4.1.2",
|
||||
"css-loader": "^0.28.7",
|
||||
"eslint": "^4.7.2",
|
||||
"eslint-plugin-html": "^3.2.2",
|
||||
"eslint-plugin-vue-libs": "^1.2.1",
|
||||
"html-webpack-plugin": "^2.30.1",
|
||||
"istanbul-instrumenter-loader": "^3.0.0",
|
||||
"karma": "^1.4.1",
|
||||
"karma-coverage": "^1.1.1",
|
||||
"karma-coverage-istanbul-reporter": "^1.3.0",
|
||||
"karma-mocha": "^1.3.0",
|
||||
"karma-phantomjs-launcher": "^1.0.2",
|
||||
"karma-phantomjs-shim": "^1.4.0",
|
||||
"karma-sinon-chai": "^1.3.1",
|
||||
"karma-sourcemap-loader": "^0.3.7",
|
||||
"karma-spec-reporter": "0.0.31",
|
||||
"karma-webpack": "^2.0.2",
|
||||
"less": "^2.7.2",
|
||||
"less-loader": "^4.0.5",
|
||||
"mocha": "^3.2.0",
|
||||
"pre-commit": "^1.2.2",
|
||||
"selenium-server": "^3.0.1",
|
||||
"semver": "^5.3.0",
|
||||
"sinon": "^4.0.2",
|
||||
"sinon-chai": "^2.8.0",
|
||||
"style-loader": "^0.18.2",
|
||||
"stylelint": "^8.1.1",
|
||||
"stylelint-config-standard": "^17.0.0",
|
||||
|
12
test/.eslintrc
Normal file
12
test/.eslintrc
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"extends": ["plugin:vue-libs/recommended"], // ,"plugin:vue-libs/recommended"
|
||||
"rules": {
|
||||
"comma-dangle": [2, "always-multiline"],
|
||||
"no-var": "error"
|
||||
},
|
||||
"globals": {
|
||||
"it": true,
|
||||
"describe": true,
|
||||
"expect": true
|
||||
}
|
||||
}
|
13
test/index.js
Normal file
13
test/index.js
Normal file
@ -0,0 +1,13 @@
|
||||
import Vue from 'vue'
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
// require all test files (files that ends with .spec.js)
|
||||
const testsContext = require.context('./specs', true, /\.spec$/)
|
||||
testsContext.keys().forEach(testsContext)
|
||||
|
||||
// require all src files except main.js for coverage.
|
||||
// you can also change this to match only the subset of files that
|
||||
// you want coverage for.
|
||||
const srcContext = require.context('../components', true, /^\.(\.js|\.vue)?$/)
|
||||
srcContext.keys().forEach(srcContext)
|
74
test/karma.conf.js
Normal file
74
test/karma.conf.js
Normal file
@ -0,0 +1,74 @@
|
||||
// This is a karma config file. For more details see
|
||||
// http://karma-runner.github.io/0.13/config/configuration-file.html
|
||||
// we are also using it with karma-webpack
|
||||
// https://github.com/webpack/karma-webpack
|
||||
|
||||
const webpack = require('webpack')
|
||||
const webpackConfig = require('../webpack.config')
|
||||
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
// to run in additional browsers:
|
||||
// 1. install corresponding karma launcher
|
||||
// http://karma-runner.github.io/0.13/config/browsers.html
|
||||
// 2. add it to the `browsers` array below.
|
||||
browsers: ['PhantomJS'],
|
||||
frameworks: ['mocha', 'sinon-chai'],
|
||||
reporters: ['spec', 'coverage-istanbul'],
|
||||
files: ['./index.js'],
|
||||
preprocessors: {
|
||||
'./index.js': ['webpack', 'sourcemap', 'coverage'],
|
||||
},
|
||||
webpack: {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.vue$/,
|
||||
loader: 'vue-loader',
|
||||
options: {
|
||||
loaders: {
|
||||
js: 'babel-loader',
|
||||
},
|
||||
postLoaders: {
|
||||
js: 'istanbul-instrumenter-loader?esModules=true',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
loader: 'babel-loader', exclude: /node_modules/,
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpg|gif|svg)$/,
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: '[name].[ext]?[hash]',
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.less$/,
|
||||
use: [
|
||||
{ loader: 'style-loader' },
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: { sourceMap: true },
|
||||
},
|
||||
{ loader: 'less-loader',
|
||||
options: { sourceMap: true },
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
webpackMiddleware: {
|
||||
noInfo: true,
|
||||
},
|
||||
coverageReporter: {
|
||||
dir: './coverage',
|
||||
reporters: [
|
||||
{ type: 'text-summary' },
|
||||
],
|
||||
},
|
||||
})
|
||||
}
|
14
test/specs/Button.spec.js
Normal file
14
test/specs/Button.spec.js
Normal file
@ -0,0 +1,14 @@
|
||||
import Vue from 'vue'
|
||||
import Button from '../../components/button'
|
||||
|
||||
describe('Button.vue', () => {
|
||||
it('should render correct contents', () => {
|
||||
const Constructor = Vue.extend(Button)
|
||||
const ele = document.createElement('div')
|
||||
document.body.appendChild(ele)
|
||||
const vm = new Constructor({ propsData: { type: 'primary' }})
|
||||
vm.$mount(ele)
|
||||
expect(vm.$el.classList.contains('ant-btn-primary'))
|
||||
.to.equal(true)
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue
Block a user