added tests, not yet working
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
__pycache__
|
||||
db.sqlite3
|
||||
run_dev.sh
|
||||
|
||||
1398
frontend/package-lock.json
generated
1398
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,8 @@
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"lint": "vue-cli-service lint"
|
||||
"lint": "vue-cli-service lint",
|
||||
"test": "mocha-webpack --webpack-config node_modules/@vue/cli-service/webpack.config.js --require test/setup.js test/**/*.spec.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"core-js": "^2.6.5",
|
||||
@@ -17,15 +18,22 @@
|
||||
"@vue/cli-plugin-babel": "^3.5.0",
|
||||
"@vue/cli-plugin-eslint": "^3.5.0",
|
||||
"@vue/cli-service": "^3.6.0",
|
||||
"@vue/test-utils": "^1.0.0-beta.29",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"chai": "^4.2.0",
|
||||
"eslint": "^5.8.0",
|
||||
"eslint-plugin-vue": "^5.0.0",
|
||||
"jsdom": "^14.0.0",
|
||||
"jsdom-global": "^3.0.2",
|
||||
"mocha": "^6.1.4",
|
||||
"mocha-webpack": "^1.1.0",
|
||||
"stylus": "^0.54.5",
|
||||
"stylus-loader": "^3.0.1",
|
||||
"vue-cli-plugin-vuetify": "^0.5.0",
|
||||
"vue-template-compiler": "^2.5.21",
|
||||
"vuetify-loader": "^1.0.5",
|
||||
"webpack-bundle-tracker": "^0.4.2-beta"
|
||||
"webpack-bundle-tracker": "^0.4.2-beta",
|
||||
"webpack-node-externals": "^1.7.2"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
|
||||
@@ -1,6 +1,30 @@
|
||||
<template>
|
||||
<v-app>
|
||||
<v-toolbar app tabs>
|
||||
<v-navigation-drawer app v-model="showNav">
|
||||
<v-list>
|
||||
<v-list-tile>
|
||||
<v-list-tile-title>
|
||||
CookAssistant
|
||||
</v-list-tile-title>
|
||||
</v-list-tile>
|
||||
</v-list>
|
||||
<v-list dense>
|
||||
<v-list-tile
|
||||
v-for="link in links"
|
||||
:key="link.path"
|
||||
:to="link.path"
|
||||
>
|
||||
<v-list-tile-avatar>
|
||||
<v-icon v-html="link.icon"
|
||||
></v-icon>
|
||||
</v-list-tile-avatar>
|
||||
<v-list-tile-title v-html="link.text"
|
||||
></v-list-tile-title>
|
||||
</v-list-tile>
|
||||
</v-list>
|
||||
</v-navigation-drawer>
|
||||
|
||||
<v-toolbar app>
|
||||
<v-toolbar-side-icon
|
||||
@click.stop="showNav = !showNav"
|
||||
></v-toolbar-side-icon>
|
||||
@@ -21,29 +45,11 @@
|
||||
<router-view name="extension"></router-view>
|
||||
</template>
|
||||
</v-toolbar>
|
||||
<v-navigation-drawer
|
||||
fixed
|
||||
app
|
||||
clipped
|
||||
v-model="showNav"
|
||||
>
|
||||
<v-list dense>
|
||||
<v-list-tile
|
||||
v-for="link in links"
|
||||
:key="link.path"
|
||||
:to="link.path"
|
||||
>
|
||||
<v-list-tile-avatar>
|
||||
<v-icon v-html="link.icon"
|
||||
></v-icon>
|
||||
</v-list-tile-avatar>
|
||||
<v-list-tile-title v-html="link.text"
|
||||
></v-list-tile-title>
|
||||
</v-list-tile>
|
||||
</v-list>
|
||||
</v-navigation-drawer>
|
||||
|
||||
<v-content>
|
||||
<router-view></router-view>
|
||||
<v-container fluid>
|
||||
<router-view></router-view>
|
||||
</v-container>
|
||||
</v-content>
|
||||
</v-app>
|
||||
</template>
|
||||
|
||||
@@ -1,40 +1,33 @@
|
||||
<template>
|
||||
<!-- Categories list -->
|
||||
<span>
|
||||
<v-tabs v-if="showTabs" :mandatory="false">
|
||||
<v-tab v-for="key in Object.keys(categories)"
|
||||
:key="`cat-${key}`"
|
||||
:to="`/recipes/category/${key}`">
|
||||
{{ categories[key] }}
|
||||
</v-tab>
|
||||
</v-tabs>
|
||||
<template v-else>
|
||||
<v-toolbar-title>
|
||||
Détails
|
||||
</v-toolbar-title>
|
||||
<v-btn v-show="!showTabs"
|
||||
icon
|
||||
@click="$router.go(-1)"
|
||||
><v-icon>arrow_back</v-icon></v-btn>
|
||||
</template>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { RecipeCategories } from '../App'
|
||||
|
||||
export default {
|
||||
data: () => ({
|
||||
categories: RecipeCategories,
|
||||
}),
|
||||
computed: {
|
||||
showTabs: function() {
|
||||
return !(this.$route.path.startsWith("/recipes/id"))
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
<template>
|
||||
<!-- Categories list -->
|
||||
<v-tabs v-if="showTabs" :mandatory="false">
|
||||
<v-tab v-for="key in Object.keys(categories)"
|
||||
:key="`cat-${key}`"
|
||||
:to="`/recipes/category/${key}`">
|
||||
{{ categories[key] }}
|
||||
</v-tab>
|
||||
</v-tabs>
|
||||
<v-btn v-else
|
||||
icon
|
||||
@click="$router.go(-1)"
|
||||
><v-icon>arrow_back</v-icon></v-btn>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { RecipeCategories } from '../App'
|
||||
|
||||
export default {
|
||||
data: () => ({
|
||||
categories: RecipeCategories,
|
||||
}),
|
||||
computed: {
|
||||
showTabs: function() {
|
||||
return !(this.$route.path.startsWith("/recipes/id"))
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
|
||||
10
frontend/test/RessourceField.spec.js
Normal file
10
frontend/test/RessourceField.spec.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import { shallowMount } from '@vue/test-utils'
|
||||
import RessourceField from '../src/components/RessourceField'
|
||||
|
||||
describe('RessourceField.vue', () => {
|
||||
|
||||
it('first test', () => {
|
||||
let field = shallowMount(RessourceField)
|
||||
expect(field).to.equal("Name")
|
||||
})
|
||||
})
|
||||
6
frontend/test/setup.js
Normal file
6
frontend/test/setup.js
Normal file
@@ -0,0 +1,6 @@
|
||||
require('jsdom-global')(undefined, { pretendToBeVisual: true, url: 'http://localhost' })
|
||||
|
||||
window.Date = Date
|
||||
global.expect = require('chai').expect
|
||||
|
||||
// See https://github.com/vuejs/vue-cli/issues/2128#issuecomment-453109575
|
||||
@@ -1,4 +1,5 @@
|
||||
const BundleTracker = require("webpack-bundle-tracker");
|
||||
const nodeExternals = require("webpack-node-externals");
|
||||
|
||||
module.exports = {
|
||||
publicPath: "http://localhost:8080/",
|
||||
@@ -6,6 +7,8 @@ module.exports = {
|
||||
|
||||
chainWebpack: config => {
|
||||
|
||||
config.devtool = "inline-cheap-module-source-map",
|
||||
config.externals = [nodeExternals()],
|
||||
config.optimization
|
||||
.splitChunks(false)
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"status":"done","publicPath":"http://localhost:8080/","chunks":{"null":[{"name":"0.js","publicPath":"http://localhost:8080/0.js","path":"/home/artus/Documents/cookAssistant/frontend/dist/0.js"},{"name":"0.880af34e5f0e1c2d5443.hot-update.js","publicPath":"http://localhost:8080/0.880af34e5f0e1c2d5443.hot-update.js","path":"/home/artus/Documents/cookAssistant/frontend/dist/0.880af34e5f0e1c2d5443.hot-update.js"}],"app":[{"name":"app.js","publicPath":"http://localhost:8080/app.js","path":"/home/artus/Documents/cookAssistant/frontend/dist/app.js"}]},"error":"ModuleBuildError","message":"Module build failed (from ./node_modules/babel-loader/lib/index.js):\nSyntaxError: /home/artus/Documents/cookAssistant/frontend/src/components/recipes/IngredientList.vue: Unexpected token (85:70)\n\n 83 | )\n 84 | .then(data => {\n> 85 | var idx = this.edited_ingdts.indexOf(i => i.ingredient.id ==)\n | ^\n 86 | })\n 87 | .catch(err => comp.errors.push(JSON.stringify(err)))\n 88 | },\n at Object.raise (/home/artus/Documents/cookAssistant/frontend/node_modules/@babel/parser/lib/index.js:3851:17)\n at Object.unexpected (/home/artus/Documents/cookAssistant/frontend/node_modules/@babel/parser/lib/index.js:5167:16)\n at Object.parseExprAtom (/home/artus/Documents/cookAssistant/frontend/node_modules/@babel/parser/lib/index.js:6328:20)\n at Object.parseExprAtom (/home/artus/Documents/cookAssistant/frontend/node_modules/@babel/parser/lib/index.js:3570:20)\n at Object.parseExprSubscripts (/home/artus/Documents/cookAssistant/frontend/node_modules/@babel/parser/lib/index.js:5914:23)\n at Object.parseMaybeUnary (/home/artus/Documents/cookAssistant/frontend/node_modules/@babel/parser/lib/index.js:5894:21)\n at Object.parseExprOpBaseRightExpr (/home/artus/Documents/cookAssistant/frontend/node_modules/@babel/parser/lib/index.js:5854:34)\n at Object.parseExprOpRightExpr (/home/artus/Documents/cookAssistant/frontend/node_modules/@babel/parser/lib/index.js:5847:21)\n at Object.parseExprOp (/home/artus/Documents/cookAssistant/frontend/node_modules/@babel/parser/lib/index.js:5826:27)\n at Object.parseExprOps (/home/artus/Documents/cookAssistant/frontend/node_modules/@babel/parser/lib/index.js:5791:17)\n at Object.parseMaybeConditional (/home/artus/Documents/cookAssistant/frontend/node_modules/@babel/parser/lib/index.js:5754:23)\n at Object.parseMaybeAssign (/home/artus/Documents/cookAssistant/frontend/node_modules/@babel/parser/lib/index.js:5701:21)\n at Object.parseFunctionBody (/home/artus/Documents/cookAssistant/frontend/node_modules/@babel/parser/lib/index.js:6891:24)\n at Object.parseArrowExpression (/home/artus/Documents/cookAssistant/frontend/node_modules/@babel/parser/lib/index.js:6851:10)\n at Object.parseExprAtom (/home/artus/Documents/cookAssistant/frontend/node_modules/@babel/parser/lib/index.js:6213:18)\n at Object.parseExprAtom (/home/artus/Documents/cookAssistant/frontend/node_modules/@babel/parser/lib/index.js:3570:20)"}
|
||||
{"status":"done","publicPath":"http://localhost:8080/","chunks":{"null":[{"name":"0.js","publicPath":"http://localhost:8080/0.js","path":"/home/artus/Documents/cookAssistant/frontend/dist/0.js"}],"app":[{"name":"app.js","publicPath":"http://localhost:8080/app.js","path":"/home/artus/Documents/cookAssistant/frontend/dist/app.js"}]},"error":"ModuleError","message":"Module Error (from ./node_modules/vue-loader/lib/loaders/templateLoader.js):\n(Emitted value instead of an instance of Error) \n\n Errors compiling template:\n\n tag <span> has no matching end tag.\n\n 1 | \n 2 | <!-- Categories list -->\n | \n 3 | <span>\n | ^^^^^^\n 4 | <v-tabs v-if=\"showTabs\" :mandatory=\"false\">\n"}
|
||||
Reference in New Issue
Block a user