Skip to content

Commit 855914f

Browse files
author
Charlie Kassel
committed
add tests using chai expect rules
1 parent 77488f4 commit 855914f

File tree

17 files changed

+1055
-693
lines changed

17 files changed

+1055
-693
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build/*.js

.eslintrc.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module.exports = {
2+
root: true,
3+
parser: 'babel-eslint',
4+
parserOptions: {
5+
sourceType: 'module'
6+
},
7+
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
8+
extends: 'standard',
9+
// required to lint *.vue files
10+
plugins: [
11+
'html'
12+
],
13+
// add your custom rules here
14+
'rules': {
15+
// allow paren-less arrow functions
16+
'arrow-parens': 0,
17+
// allow async-await
18+
'generator-star-spacing': 0,
19+
// allow debugger during development
20+
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
21+
}
22+
}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.DS_Store
22
node_modules
3-
npm-debug.log
3+
npm-debug.log
4+
test/coverage/*

build/utils.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
var ExtractTextPlugin = require('extract-text-webpack-plugin')
2+
3+
exports.cssLoaders = function (options) {
4+
options = options || {}
5+
// generate loader string to be used with extract text plugin
6+
function generateLoaders (loaders) {
7+
var sourceLoader = loaders.map(function (loader) {
8+
var extraParamChar
9+
if (/\?/.test(loader)) {
10+
loader = loader.replace(/\?/, '-loader?')
11+
extraParamChar = '&'
12+
} else {
13+
loader = loader + '-loader'
14+
extraParamChar = '?'
15+
}
16+
return loader + (options.sourceMap ? extraParamChar + 'sourceMap' : '')
17+
}).join('!')
18+
19+
if (options.extract) {
20+
return ExtractTextPlugin.extract('vue-style-loader', sourceLoader)
21+
} else {
22+
return ['vue-style-loader', sourceLoader].join('!')
23+
}
24+
}
25+
26+
// http://vuejs.github.io/vue-loader/configurations/extract-css.html
27+
return {
28+
css: generateLoaders(['css']),
29+
postcss: generateLoaders(['css']),
30+
less: generateLoaders(['css', 'less']),
31+
sass: generateLoaders(['css', 'sass?indentedSyntax']),
32+
scss: generateLoaders(['css', 'sass']),
33+
stylus: generateLoaders(['css', 'stylus']),
34+
styl: generateLoaders(['css', 'stylus'])
35+
}
36+
}
37+
38+
// Generate loaders for standalone style files (outside of .vue)
39+
exports.styleLoaders = function (options) {
40+
var output = []
41+
var loaders = exports.cssLoaders(options)
42+
for (var extension in loaders) {
43+
var loader = loaders[extension]
44+
output.push({
45+
test: new RegExp('\\.' + extension + '$'),
46+
loader: loader
47+
})
48+
}
49+
return output
50+
}

dist/build.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/build.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">
5-
<title>simple.1.0</title>
5+
<title>Vue.js Datepicker</title>
66
</head>
77
<body>
88
<datepicker></datepicker>

package.json

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,55 @@
2121
"license": "MIT",
2222
"scripts": {
2323
"dev": "webpack-dev-server --inline --hot",
24-
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
24+
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules",
25+
"test": "karma start test/karma.conf.js --single-run"
2526
},
2627
"dependencies": {
2728
"vue": "^1.0.0",
2829
"babel-runtime": "^6.0.0"
2930
},
3031
"devDependencies": {
3132
"babel-core": "^6.0.0",
33+
"babel-eslint": "^6.1.2",
3234
"babel-loader": "^6.0.0",
3335
"babel-plugin-transform-runtime": "^6.0.0",
3436
"babel-preset-es2015": "^6.0.0",
3537
"babel-preset-stage-2": "^6.0.0",
38+
"chai": "^3.5.0",
3639
"cross-env": "^1.0.6",
3740
"css-loader": "^0.23.0",
41+
"eslint": "^2.10.2",
42+
"eslint-config-standard": "^5.1.0",
43+
"eslint-friendly-formatter": "^2.0.5",
44+
"eslint-loader": "^1.3.0",
45+
"eslint-plugin-html": "^1.3.0",
46+
"eslint-plugin-promise": "^1.0.8",
47+
"eslint-plugin-standard": "^1.3.2",
48+
"eventsource-polyfill": "^0.9.6",
49+
"express": "^4.13.3",
50+
"extract-text-webpack-plugin": "^1.0.1",
3851
"file-loader": "^0.8.4",
52+
"function-bind": "^1.1.0",
53+
"html-webpack-plugin": "^2.8.1",
54+
"http-proxy-middleware": "^0.12.0",
55+
"inject-loader": "^2.0.1",
56+
"isparta-loader": "^2.0.0",
3957
"json-loader": "^0.5.4",
58+
"karma": "^0.13.15",
59+
"karma-coverage": "^0.5.5",
60+
"karma-mocha": "^0.2.2",
61+
"karma-phantomjs-launcher": "^1.0.0",
62+
"karma-sinon-chai": "^1.2.0",
63+
"karma-sourcemap-loader": "^0.3.7",
64+
"karma-spec-reporter": "0.0.24",
65+
"karma-webpack": "^1.7.0",
66+
"lolex": "^1.4.0",
67+
"mocha": "^2.4.5",
68+
"ora": "^0.2.0",
69+
"phantomjs-prebuilt": "^2.1.3",
70+
"shelljs": "^0.6.0",
71+
"sinon": "^1.17.3",
72+
"sinon-chai": "^2.8.0",
4073
"stylus": "^0.54.5",
4174
"stylus-loader": "^2.3.1",
4275
"url-loader": "^0.5.7",
@@ -45,6 +78,8 @@
4578
"vue-loader": "^8.2.1",
4679
"vue-style-loader": "^1.0.0",
4780
"webpack": "^1.12.2",
48-
"webpack-dev-server": "^1.12.0"
81+
"webpack-dev-server": "^1.12.0",
82+
"webpack-hot-middleware": "^2.6.0",
83+
"webpack-merge": "^0.8.3"
4984
}
5085
}

0 commit comments

Comments
 (0)