├── .babelrc ├── .eslintrc.js ├── .gitignore ├── .storybook ├── addons.js └── config.js ├── README.md ├── assets ├── css │ └── main.css └── img │ └── logo.png ├── backpack.config.js ├── components ├── AdminNav.vue ├── Button.story.js ├── Button.vue ├── Footer.story.js ├── Footer.vue └── __snapshots__ │ ├── Button.story.storyshot │ └── Footer.story.storyshot ├── images └── footer-component-error.png ├── layouts ├── default.vue └── error.vue ├── nuxt.config.js ├── package-lock.json ├── package.json ├── pages ├── _id.vue ├── admin │ └── index.vue └── index.vue ├── plugins ├── axios.js └── eventsHub.js ├── server ├── api │ ├── auth.js │ └── index.js └── index.js ├── static ├── default_profile_pic.jpg └── favicon.ico ├── store └── index.js ├── test └── unit │ ├── .eslintrc │ ├── coverage │ ├── clover.xml │ ├── coverage-final.json │ ├── lcov-report │ │ ├── base.css │ │ ├── components │ │ │ ├── AdminNav.vue.html │ │ │ ├── Button.story.js.html │ │ │ ├── Button.vue.html │ │ │ ├── Footer.story.js.html │ │ │ ├── Footer.vue.html │ │ │ └── index.html │ │ ├── index.html │ │ ├── layouts │ │ │ ├── default.vue.html │ │ │ ├── error.vue.html │ │ │ └── index.html │ │ ├── pages │ │ │ ├── _id.vue.html │ │ │ ├── admin │ │ │ │ ├── index.html │ │ │ │ └── index.vue.html │ │ │ ├── index.html │ │ │ └── index.vue.html │ │ ├── prettify.css │ │ ├── prettify.js │ │ ├── sort-arrow-sprite.png │ │ └── sorter.js │ └── lcov.info │ ├── jest.conf.js │ ├── specs │ ├── components │ │ ├── Button.spec.js │ │ ├── Footer.spec.js │ │ └── __snapshots__ │ │ │ ├── Button.spec.js.snap │ │ │ └── Footer.spec.js.snap │ ├── layouts │ │ ├── __snapshots__ │ │ │ └── default.spec.js.snap │ │ └── default.spec.js │ └── pages │ │ ├── __snapshots__ │ │ └── index.spec.js.snap │ │ └── index.spec.js │ └── storyshots.test.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "env", 4 | "vue" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parser: 'babel-eslint', 4 | env: { 5 | browser: true, 6 | node: true 7 | }, 8 | extends: 'airbnb-base', 9 | // required to lint *.vue files 10 | plugins: [ 11 | 'html' 12 | ], 13 | // add your custom rules here 14 | rules: { 15 | // don't require .vue extension when importing 16 | "import/extensions": 0, 17 | "no-param-reassign": 0, 18 | "arrow-body-style": 0, 19 | "no-underscore-dangle": 0, 20 | "max-len": 0, 21 | camelcase: 0, 22 | // allow optionalDependencies 23 | "import/no-extraneous-dependencies": [ 24 | "error", 25 | { 26 | optionalDependencies: ["test/unit/index.js"] 27 | } 28 | ], 29 | "import/no-unresolved": [ 30 | "error", 31 | { 32 | ignore: ["~", "axios"] 33 | } 34 | ], 35 | indent: ["error", 2], 36 | "no-plusplus": 0, 37 | "no-bitwise": 0, 38 | "no-control-regex": 0, 39 | }, 40 | globals: {} 41 | } 42 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules 3 | 4 | # logs 5 | npm-debug.log 6 | 7 | # Nuxt build 8 | .nuxt 9 | 10 | # Nuxt generate 11 | dist 12 | 13 | # Backpack build 14 | build 15 | 16 | # Misc 17 | .tutorials 18 | /.buildpath 19 | /build/ 20 | */archive/ 21 | 22 | __MACOSX 23 | .DS_Store 24 | 25 | .project 26 | .settings 27 | .classpath 28 | .sass-cache/ 29 | 30 | # OS generated files # 31 | ###################### 32 | */.DS_Store 33 | .DS_Store 34 | .DS_Store? 35 | ._* 36 | .Spotlight-V100 37 | .Trashes 38 | Icon? 39 | ehthumbs.db 40 | Thumbs.db 41 | 42 | # Packages # 43 | ############ 44 | # it's better to unpack these files and commit the raw source 45 | # git has its own built in compression methods 46 | *.7z 47 | *.dmg 48 | *.gz 49 | *.iso 50 | *.jar 51 | *.rar 52 | *.tar 53 | *.zip -------------------------------------------------------------------------------- /.storybook/addons.js: -------------------------------------------------------------------------------- 1 | import '@storybook/addon-actions/register' 2 | import '@storybook/addon-links/register' 3 | -------------------------------------------------------------------------------- /.storybook/config.js: -------------------------------------------------------------------------------- 1 | import { configure } from '@storybook/vue'; 2 | 3 | import Vue from 'vue'; 4 | // import Vuex from 'vuex'; // Vue plugins 5 | 6 | const req = require.context('../components', true, /\.story\.js$/) 7 | 8 | function loadStories() { 9 | req.keys().forEach((filename) => req(filename)) 10 | } 11 | 12 | configure(loadStories, module); -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Nuxt Starter Kit v2 2 | 3 | > I've learned a lot about Nuxt and best practices. Instead of trying to restructure v1 of my starter kit I decided to start fresh. Based off of the [Nuxt Express template](https://github.com/nuxt-community/express-template). 4 | 5 | 6 | 7 | ## Build Setup 8 | 9 | ``` bash 10 | # install dependencies 11 | $ npm install # Or yarn install 12 | 13 | # serve with hot reload at localhost:3000 14 | $ npm run dev 15 | 16 | # build for production and launch server 17 | $ npm start 18 | ``` 19 | 20 | For detailed explanation on how Nuxt works, checkout the [Nuxt.js docs](https://github.com/nuxt/nuxt.js). 21 | 22 | ## Backpack 23 | 24 | Nuxt uses [backpack](https://github.com/palmerhq/backpack) to watch and build the application, so you can use the latest ES6 features (module syntax, async/await, etc.). 25 | 26 | ## Storybook 27 | 28 | > [Storybook](https://storybook.js.org/basics/guide-vue/) is a development environment for UI components. It allows you to browse a component library, view the different states of each component, and interactively develop and test components. 29 | 30 | ``` bash 31 | # build and run Storybook 32 | $ npm run storybook 33 | ``` 34 | 35 | Stories are written in the components folder. This is not a hard and fast rule. You can change where stories are located by changing the config in `.storybook/config.js`. Out of the box it's set to look for any files inside of the `components` directory that has a `.story.js` extension. 36 | 37 | ## Authentication and Authorization 38 | Using Express and Axios this project allows you to auth users and protect pages. `server/api/auth.js` shows the endpoints used to log a user in. You can find [documentation on what the endpoints expect and return on Postman.](https://documenter.getpostman.com/view/3748927/nuxt-starter-kit-v2/RVg2AoNd) It uses `store/index.js` to manage the state of a user and send login/logout actions. Also check `pages/index.vue` to see what methods to use to log in and `pages/admin/index.vue` to see how to protect a page so only authenticated users can see it. -------------------------------------------------------------------------------- /assets/css/main.css: -------------------------------------------------------------------------------- 1 | html, body 2 | { 3 | background-color: #fff; 4 | color: #000; 5 | letter-spacing: 0.5px; 6 | font-family: "Source Sans Pro", Arial, sans-serif; 7 | height: 100vh; 8 | margin: 0; 9 | } 10 | 11 | footer 12 | { 13 | padding: 20px; 14 | text-align: center; 15 | border-top: 1px solid #ddd; 16 | } 17 | 18 | a, a:hover, a:focus, a:visited 19 | { 20 | color: #000; 21 | } 22 | 23 | .logo { 24 | width: 100%; 25 | height: auto; 26 | max-width: 400px; 27 | max-height: 289px; 28 | } 29 | -------------------------------------------------------------------------------- /assets/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itsMattShull/nuxt-starter-kit-v2/b18615b11fddea31c627df5e44eb37f5fcd55899/assets/img/logo.png -------------------------------------------------------------------------------- /backpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | webpack: (config, options, webpack) => { 3 | config.entry.main = './server/index.js' 4 | return config 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /components/AdminNav.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 39 | 40 | -------------------------------------------------------------------------------- /components/Button.story.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue'; 2 | import { action } from '@storybook/addon-actions'; 3 | // import { linkTo } from '@storybook/addon-links'; 4 | // import { addonNotes } from '@storybook/addon-notes'; 5 | // import { addonKnobs, text, number, boolean, array, select, color, date } from '@storybook/addon-knobs'; 6 | import MyButton from './Button.vue'; 7 | 8 | storiesOf('MyButton', module) 9 | // Works if Vue.component is called in the config.js in .storybook 10 | .add('rounded', () => ({ 11 | components: { MyButton }, 12 | template: 'A Button with rounded edges', 13 | })) 14 | .add('square', () => ({ 15 | components: { MyButton }, 16 | template: 'A Button with square edges', 17 | })) 18 | .add('change color', () => ({ 19 | components: { MyButton }, 20 | template: 'A Button with changed colors', 21 | })) 22 | .add('template + methods', () => ({ 23 | components: { MyButton }, 24 | template: ` 25 |

26 | MyButton rendered in a template + props & methods 27 |

`, 28 | methods: { log: action('log1') }, 29 | })); 30 | -------------------------------------------------------------------------------- /components/Button.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 18 | 19 | 32 | -------------------------------------------------------------------------------- /components/Footer.story.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue'; 2 | 3 | import MyFooter from './Footer.vue'; 4 | 5 | storiesOf('MyFooter', module) 6 | .add('story as a component', () => ({ 7 | components: { MyFooter }, 8 | template: 'story as a component', 9 | })); 10 | -------------------------------------------------------------------------------- /components/Footer.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | -------------------------------------------------------------------------------- /components/__snapshots__/Button.story.storyshot: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Storyshots MyButton change color 1`] = ` 4 | 10 | `; 11 | 12 | exports[`Storyshots MyButton rounded 1`] = ` 13 | 19 | `; 20 | 21 | exports[`Storyshots MyButton square 1`] = ` 22 | 28 | `; 29 | 30 | exports[`Storyshots MyButton template + methods 1`] = ` 31 |

32 | 38 |

39 | `; 40 | -------------------------------------------------------------------------------- /components/__snapshots__/Footer.story.storyshot: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Storyshots MyFooter story as a component 1`] = ` 4 | 14 | `; 15 | -------------------------------------------------------------------------------- /images/footer-component-error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itsMattShull/nuxt-starter-kit-v2/b18615b11fddea31c627df5e44eb37f5fcd55899/images/footer-component-error.png -------------------------------------------------------------------------------- /layouts/default.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 17 | 18 | 53 | -------------------------------------------------------------------------------- /layouts/error.vue: -------------------------------------------------------------------------------- 1 | 15 | 20 | 21 | 38 | -------------------------------------------------------------------------------- /nuxt.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | /* 3 | ** Headers of the page 4 | */ 5 | head: { 6 | title: 'starter', 7 | meta: [ 8 | { charset: 'utf-8' }, 9 | { name: 'viewport', content: 'width=device-width, initial-scale=1' }, 10 | { hid: 'description', name: 'description', content: 'Nuxt.js project' }, 11 | ], 12 | link: [ 13 | { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }, 14 | ], 15 | }, 16 | modules: [ 17 | '@nuxtjs/axios', 18 | ], 19 | plugins: [ 20 | '~/plugins/axios', 21 | ], 22 | axios: { 23 | // baseURL: `http://${process.env.HOST || 'localhost'}:${process.env.PORT || 3000}`, 24 | baseURL: 'https://c3c8ff6e-057d-43f7-98fa-595b3622ec0d.mock.pstmn.io', 25 | browserBaseURL: '/', 26 | }, 27 | /* 28 | ** Global CSS 29 | */ 30 | css: ['~/assets/css/main.css'], 31 | /* 32 | ** Add axios globally 33 | */ 34 | build: { 35 | vendor: ['axios'], 36 | /* 37 | ** Run ESLINT on save 38 | */ 39 | extend(config, ctx) { 40 | if (ctx.isClient) { 41 | config.module.rules.push({ 42 | enforce: 'pre', 43 | test: /\.(js|vue)$/, 44 | loader: 'eslint-loader', 45 | exclude: /(node_modules)/, 46 | }); 47 | } 48 | }, 49 | }, 50 | }; 51 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-project", 3 | "version": "1.0.0", 4 | "description": "Nuxt.js project", 5 | "author": "Matt Shull ", 6 | "private": true, 7 | "scripts": { 8 | "dev": "backpack dev", 9 | "build": "nuxt build && backpack build", 10 | "start": "cross-env NODE_ENV=production node build/main.js", 11 | "precommit": "npm run lint", 12 | "lint": "eslint --ext .js,.vue --ignore-path .gitignore .", 13 | "storybook": "start-storybook -p 9001 -c .storybook", 14 | "test": "jest --config test/unit/jest.conf.js --coverage" 15 | }, 16 | "dependencies": { 17 | "@nuxtjs/axios": "^5.0.1", 18 | "@storybook/addon-actions": "^3.3.14", 19 | "axios": "^0.16.2", 20 | "body-parser": "^1.18.2", 21 | "cross-env": "^5.0.1", 22 | "express": "^4.15.3", 23 | "express-session": "^1.15.6", 24 | "lory.js": "^2.3.4", 25 | "nuxt": "^1.0.0-rc3", 26 | "request": "^2.83.0", 27 | "source-map-support": "^0.4.15", 28 | "vue": "^2.5.13", 29 | "vue-loader": "13.7.0", 30 | "vuex": "^3.0.1" 31 | }, 32 | "devDependencies": { 33 | "@storybook/addon-storyshots": "^3.4.0-alpha.5", 34 | "@storybook/addons": "^3.4.0-alpha.5", 35 | "@storybook/vue": "3.4.0-alpha.5", 36 | "@vue/test-utils": "^1.0.0-beta.10", 37 | "babel-core": "^6.26.0", 38 | "babel-eslint": "^7.2.3", 39 | "backpack-core": "^0.4.1", 40 | "eslint": "^4.3.0", 41 | "eslint-config-airbnb-base": "^12.1.0", 42 | "eslint-config-standard": "^10.2.1", 43 | "eslint-loader": "^1.9.0", 44 | "eslint-plugin-html": "^3.1.1", 45 | "eslint-plugin-import": "^2.7.0", 46 | "eslint-plugin-node": "^5.1.1", 47 | "eslint-plugin-promise": "^3.5.0", 48 | "eslint-plugin-standard": "^3.0.1", 49 | "jest": "^22.1.4", 50 | "jest-serializer-vue": "^0.3.0", 51 | "jest-vue-preprocessor": "^1.3.1", 52 | "node-sass": "^4.7.2", 53 | "react-test-renderer": "^16.2.0", 54 | "sass-loader": "^6.0.6", 55 | "vue-jest": "^1.4.0", 56 | "vue-server-renderer": "^2.5.13", 57 | "vue-template-compiler": "^2.5.13" 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /pages/_id.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 33 | 34 | 51 | -------------------------------------------------------------------------------- /pages/admin/index.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 41 | 42 | -------------------------------------------------------------------------------- /pages/index.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 58 | 59 | 73 | -------------------------------------------------------------------------------- /plugins/axios.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line 2 | export default ({ $axios, redirect, app, store }) => { 3 | $axios.onRequest((config) => { 4 | if (store.state.user) { 5 | // eslint-disable-next-line 6 | config.headers.common['Authorization'] = store.state.user.token; 7 | } 8 | }); 9 | 10 | $axios.onResponseError((error) => { 11 | const request = error.config; 12 | if (store.state.user && error.response && error.response.status === 401 && !request.retry) { 13 | request.retry = true; 14 | $axios.get(`https://c3c8ff6e-057d-43f7-98fa-595b3622ec0d.mock.pstmn.io/refreshtoken?token=${store.state.user.token}`).then((response) => { 15 | store.state.user = response.data; 16 | return $axios(request); 17 | }).catch(async () => { 18 | await store.dispatch('logout'); 19 | redirect('/'); 20 | }); 21 | } 22 | }); 23 | }; 24 | -------------------------------------------------------------------------------- /plugins/eventsHub.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | 3 | export default new Vue(); 4 | -------------------------------------------------------------------------------- /server/api/auth.js: -------------------------------------------------------------------------------- 1 | import { Router } from 'express'; 2 | import axios from 'axios'; 3 | 4 | const router = Router(); 5 | 6 | router.post('/login', (req, res) => { 7 | try { 8 | axios.post('https://c3c8ff6e-057d-43f7-98fa-595b3622ec0d.mock.pstmn.io/login', { username: req.body.username, password: req.body.password }).then((tokenResponse) => { 9 | req.session.user = tokenResponse.data; 10 | res.json(req.session.user); 11 | }).catch((e) => { 12 | res.status(401).json({ error: 'Bad credentials', message: e }); 13 | }); 14 | } catch (e) { 15 | res.status(401).json({ error: 'Bad credentials' }); 16 | } 17 | }); 18 | 19 | router.get('/logout', (req, res) => { 20 | try { 21 | delete req.session.user; 22 | res.json({ message: 'it worked!' }); 23 | } catch (e) { 24 | res.status(401).json({ error: 'Bad logout' }); 25 | } 26 | }); 27 | 28 | export default router; 29 | -------------------------------------------------------------------------------- /server/api/index.js: -------------------------------------------------------------------------------- 1 | import { Router } from 'express'; 2 | 3 | import auth from './auth'; 4 | 5 | const router = Router(); 6 | 7 | // Add USERS Routes 8 | router.use(auth); 9 | 10 | export default router; 11 | -------------------------------------------------------------------------------- /server/index.js: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import { Nuxt, Builder } from 'nuxt'; 3 | import api from './api'; 4 | 5 | const session = require('express-session'); 6 | const bodyParser = require('body-parser'); 7 | 8 | const app = express(); 9 | const host = process.env.HOST || '127.0.0.1'; 10 | const port = process.env.PORT || 3000; 11 | 12 | app.use(bodyParser.urlencoded({ extended: true })); 13 | app.use(bodyParser.json()); 14 | 15 | // Sessions to create req.session 16 | app.use(session({ 17 | secret: 'super-secret-key', 18 | resave: false, 19 | saveUninitialized: false, 20 | cookie: { maxAge: 60000 }, 21 | })); 22 | 23 | app.set('port', port); 24 | 25 | // Import API Routes 26 | app.use('/api', api); 27 | 28 | // Import and Set Nuxt.js options 29 | const config = require('../nuxt.config.js'); 30 | 31 | config.dev = !(process.env.NODE_ENV === 'production'); 32 | 33 | // Init Nuxt.js 34 | const nuxt = new Nuxt(config); 35 | 36 | // Build only in dev mode 37 | if (config.dev) { 38 | const builder = new Builder(nuxt); 39 | builder.build(); 40 | } 41 | 42 | // Give nuxt middleware to express 43 | app.use(nuxt.render); 44 | 45 | // Listen the server 46 | app.listen(port, host); 47 | console.log(`Server listening on ${host}:${port}`); // eslint-disable-line no-console 48 | -------------------------------------------------------------------------------- /static/default_profile_pic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itsMattShull/nuxt-starter-kit-v2/b18615b11fddea31c627df5e44eb37f5fcd55899/static/default_profile_pic.jpg -------------------------------------------------------------------------------- /static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itsMattShull/nuxt-starter-kit-v2/b18615b11fddea31c627df5e44eb37f5fcd55899/static/favicon.ico -------------------------------------------------------------------------------- /store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import Vuex from 'vuex'; 3 | 4 | Vue.use(Vuex); 5 | 6 | const store = () => { 7 | const returnValue = new Vuex.Store({ 8 | state: { 9 | user: null, 10 | }, 11 | mutations: { 12 | SET_USER: function SET_USER(state, user) { 13 | // eslint-disable-next-line 14 | state.user = user; 15 | }, 16 | }, 17 | actions: { 18 | nuxtServerInit({ commit }, { req }) { 19 | if (req.session && req.session.user) { 20 | commit('SET_USER', req.session.user); 21 | } 22 | }, 23 | login({ commit }, { username, password }) { 24 | return this.$axios.$post('/api/login', { 25 | username, 26 | password, 27 | }).then((res) => { 28 | console.log('user: ', res); 29 | if (res.status === 401) { 30 | throw new Error('Bad credentials'); 31 | } else { 32 | return res; 33 | } 34 | }).then((user) => { 35 | commit('SET_USER', user); 36 | }); 37 | }, 38 | async logout({ commit }) { 39 | await this.$axios.$get('/api/logout').then(() => { 40 | commit('SET_USER', null); 41 | }); 42 | }, 43 | }, 44 | }); 45 | 46 | return returnValue; 47 | }; 48 | 49 | export default store; 50 | -------------------------------------------------------------------------------- /test/unit/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "jest": true 4 | }, 5 | "globals": {} 6 | } -------------------------------------------------------------------------------- /test/unit/coverage/clover.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /test/unit/coverage/coverage-final.json: -------------------------------------------------------------------------------- 1 | {"/home/jefrydco/Projects/Github/nuxt-starter-kit-v2/components/AdminNav.vue": {"path":"/home/jefrydco/Projects/Github/nuxt-starter-kit-v2/components/AdminNav.vue","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":null,"column":-1}},"1":{"start":{"line":17,"column":6},"end":{"line":null,"column":-1}}},"fnMap":{"0":{"name":"logout","decl":{"start":{"line":16,"column":12},"end":{"line":16,"column":17}},"loc":{"start":{"line":16,"column":18},"end":{"line":18,"column":5}}}},"branchMap":{},"s":{"0":0,"1":0},"f":{"0":0},"b":{}} 2 | ,"/home/jefrydco/Projects/Github/nuxt-starter-kit-v2/components/Button.vue": {"path":"/home/jefrydco/Projects/Github/nuxt-starter-kit-v2/components/Button.vue","statementMap":{"0":{"start":{"line":6,"column":15},"end":{"line":null,"column":-1}},"1":{"start":{"line":6,"column":21},"end":{"line":null,"column":-1}}},"fnMap":{"0":{"name":"_default","decl":{"start":{"line":6,"column":15},"end":{"line":null,"column":-1}},"loc":{"start":{"line":6,"column":15},"end":{"line":null,"column":-1}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":6,"column":21},"end":{"line":null,"column":-1}},"loc":{"start":{"line":6,"column":21},"end":{"line":6,"column":15}}}},"branchMap":{},"s":{"0":4,"1":0},"f":{"0":4,"1":0},"b":{}} 3 | ,"/home/jefrydco/Projects/Github/nuxt-starter-kit-v2/layouts/default.vue": {"path":"/home/jefrydco/Projects/Github/nuxt-starter-kit-v2/layouts/default.vue","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":null,"column":-1}}},"fnMap":{},"branchMap":{},"s":{"0":1},"f":{},"b":{}} 4 | ,"/home/jefrydco/Projects/Github/nuxt-starter-kit-v2/pages/_id.vue": {"path":"/home/jefrydco/Projects/Github/nuxt-starter-kit-v2/pages/_id.vue","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":null,"column":-1}},"1":{"start":{"line":6,"column":31},"end":{"line":6,"column":30}},"2":{"start":{"line":7,"column":4},"end":{"line":null,"column":-1}},"3":{"start":{"line":7,"column":64},"end":{"line":null,"column":-1}},"4":{"start":{"line":8,"column":6},"end":{"line":null,"column":-1}},"5":{"start":{"line":12,"column":4},"end":{"line":null,"column":-1}}},"fnMap":{"0":{"name":"asyncData","decl":{"start":{"line":4,"column":15},"end":{"line":6,"column":30}},"loc":{"start":{"line":6,"column":31},"end":{"line":4,"column":15}}},"1":{"name":"(anonymous_2)","decl":{"start":{"line":7,"column":53},"end":{"line":7,"column":53}},"loc":{"start":{"line":7,"column":62},"end":{"line":7,"column":11}}},"2":{"name":"(anonymous_3)","decl":{"start":{"line":7,"column":100},"end":{"line":7,"column":105}},"loc":{"start":{"line":7,"column":106},"end":{"line":7,"column":11}}},"3":{"name":"head","decl":{"start":{"line":4,"column":15},"end":{"line":11,"column":8}},"loc":{"start":{"line":11,"column":9},"end":{"line":15,"column":3}}}},"branchMap":{},"s":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0},"f":{"0":0,"1":0,"2":0,"3":0},"b":{}} 5 | ,"/home/jefrydco/Projects/Github/nuxt-starter-kit-v2/pages/index.vue": {"path":"/home/jefrydco/Projects/Github/nuxt-starter-kit-v2/pages/index.vue","statementMap":{"0":{"start":{"line":6,"column":4},"end":{"line":null,"column":-1}},"1":{"start":{"line":11,"column":4},"end":{"line":null,"column":-1}},"2":{"start":{"line":16,"column":29},"end":{"line":16,"column":28}},"3":{"start":{"line":17,"column":4},"end":{"line":19,"column":5}},"4":{"start":{"line":18,"column":6},"end":{"line":null,"column":-1}},"5":{"start":{"line":20,"column":4},"end":{"line":null,"column":-1}},"6":{"start":{"line":22,"column":11},"end":{"line":null,"column":-1}},"7":{"start":{"line":29,"column":8},"end":{"line":null,"column":-1}},"8":{"start":{"line":30,"column":8},"end":{"line":null,"column":-1}},"9":{"start":{"line":31,"column":8},"end":{"line":null,"column":-1}},"10":{"start":{"line":34,"column":8},"end":{"line":null,"column":-1}}},"fnMap":{"0":{"name":"head","decl":{"start":{"line":4,"column":15},"end":{"line":5,"column":8}},"loc":{"start":{"line":5,"column":9},"end":{"line":4,"column":15}}},"1":{"name":"data","decl":{"start":{"line":4,"column":15},"end":{"line":10,"column":8}},"loc":{"start":{"line":10,"column":9},"end":{"line":4,"column":15}}},"2":{"name":"fetch","decl":{"start":{"line":4,"column":15},"end":{"line":16,"column":28}},"loc":{"start":{"line":16,"column":29},"end":{"line":4,"column":15}}},"3":{"name":"(anonymous_9)","decl":{"start":{"line":22,"column":11},"end":{"line":null,"column":-1}},"loc":{"start":{"line":22,"column":11},"end":{"line":null,"column":-1}}}},"branchMap":{"0":{"loc":{"start":{"line":17,"column":4},"end":{"line":19,"column":5}},"type":"if","locations":[{"start":{"line":17,"column":4},"end":{"line":19,"column":5}},{"start":{"line":17,"column":4},"end":{"line":19,"column":5}}]},"1":{"loc":{"start":{"line":22,"column":11},"end":{"line":null,"column":-1}},"type":"switch","locations":[{"start":{"line":22,"column":11},"end":{"line":null,"column":-1}},{"start":{"line":22,"column":11},"end":{"line":null,"column":-1}},{"start":{"line":22,"column":11},"end":{"line":34,"column":8}},{"start":{"line":22,"column":11},"end":{"line":null,"column":-1}},{"start":{"line":22,"column":11},"end":{"line":null,"column":-1}}]}},"s":{"0":0,"1":1,"2":0,"3":0,"4":0,"5":0,"6":2,"7":0,"8":0,"9":0,"10":0},"f":{"0":0,"1":1,"2":0,"3":1},"b":{"0":[0,0],"1":[0,0,0,0,0]}} 6 | ,"/home/jefrydco/Projects/Github/nuxt-starter-kit-v2/pages/admin/index.vue": {"path":"/home/jefrydco/Projects/Github/nuxt-starter-kit-v2/pages/admin/index.vue","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":null,"column":-1}},"1":{"start":{"line":3,"column":0},"end":{"line":null,"column":-1}},"2":{"start":{"line":10,"column":29},"end":{"line":10,"column":28}},"3":{"start":{"line":11,"column":4},"end":{"line":13,"column":5}},"4":{"start":{"line":12,"column":6},"end":{"line":null,"column":-1}},"5":{"start":{"line":14,"column":4},"end":{"line":null,"column":-1}},"6":{"start":{"line":16,"column":11},"end":{"line":null,"column":-1}},"7":{"start":{"line":20,"column":8},"end":{"line":null,"column":-1}},"8":{"start":{"line":23,"column":8},"end":{"line":null,"column":-1}},"9":{"start":{"line":27,"column":12},"end":{"line":null,"column":-1}},"10":{"start":{"line":28,"column":4},"end":{"line":null,"column":-1}},"11":{"start":{"line":29,"column":6},"end":{"line":null,"column":-1}}},"fnMap":{"0":{"name":"fetch","decl":{"start":{"line":5,"column":15},"end":{"line":10,"column":28}},"loc":{"start":{"line":10,"column":29},"end":{"line":5,"column":15}}},"1":{"name":"(anonymous_8)","decl":{"start":{"line":16,"column":11},"end":{"line":null,"column":-1}},"loc":{"start":{"line":16,"column":11},"end":{"line":null,"column":-1}}},"2":{"name":"mounted","decl":{"start":{"line":5,"column":15},"end":{"line":27,"column":11}},"loc":{"start":{"line":27,"column":12},"end":{"line":31,"column":3}}},"3":{"name":"(anonymous_13)","decl":{"start":{"line":28,"column":27},"end":{"line":28,"column":32}},"loc":{"start":{"line":28,"column":33},"end":{"line":28,"column":4}}}},"branchMap":{"0":{"loc":{"start":{"line":11,"column":4},"end":{"line":13,"column":5}},"type":"if","locations":[{"start":{"line":11,"column":4},"end":{"line":13,"column":5}},{"start":{"line":11,"column":4},"end":{"line":13,"column":5}}]},"1":{"loc":{"start":{"line":16,"column":11},"end":{"line":null,"column":-1}},"type":"switch","locations":[{"start":{"line":16,"column":11},"end":{"line":null,"column":-1}},{"start":{"line":16,"column":11},"end":{"line":null,"column":-1}},{"start":{"line":16,"column":11},"end":{"line":23,"column":8}},{"start":{"line":16,"column":11},"end":{"line":null,"column":-1}},{"start":{"line":16,"column":11},"end":{"line":null,"column":-1}}]}},"s":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0},"f":{"0":0,"1":0,"2":0,"3":0},"b":{"0":[0,0],"1":[0,0,0,0,0]}} 7 | } 8 | -------------------------------------------------------------------------------- /test/unit/coverage/lcov-report/base.css: -------------------------------------------------------------------------------- 1 | body, html { 2 | margin:0; padding: 0; 3 | height: 100%; 4 | } 5 | body { 6 | font-family: Helvetica Neue, Helvetica, Arial; 7 | font-size: 14px; 8 | color:#333; 9 | } 10 | .small { font-size: 12px; } 11 | *, *:after, *:before { 12 | -webkit-box-sizing:border-box; 13 | -moz-box-sizing:border-box; 14 | box-sizing:border-box; 15 | } 16 | h1 { font-size: 20px; margin: 0;} 17 | h2 { font-size: 14px; } 18 | pre { 19 | font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace; 20 | margin: 0; 21 | padding: 0; 22 | -moz-tab-size: 2; 23 | -o-tab-size: 2; 24 | tab-size: 2; 25 | } 26 | a { color:#0074D9; text-decoration:none; } 27 | a:hover { text-decoration:underline; } 28 | .strong { font-weight: bold; } 29 | .space-top1 { padding: 10px 0 0 0; } 30 | .pad2y { padding: 20px 0; } 31 | .pad1y { padding: 10px 0; } 32 | .pad2x { padding: 0 20px; } 33 | .pad2 { padding: 20px; } 34 | .pad1 { padding: 10px; } 35 | .space-left2 { padding-left:55px; } 36 | .space-right2 { padding-right:20px; } 37 | .center { text-align:center; } 38 | .clearfix { display:block; } 39 | .clearfix:after { 40 | content:''; 41 | display:block; 42 | height:0; 43 | clear:both; 44 | visibility:hidden; 45 | } 46 | .fl { float: left; } 47 | @media only screen and (max-width:640px) { 48 | .col3 { width:100%; max-width:100%; } 49 | .hide-mobile { display:none!important; } 50 | } 51 | 52 | .quiet { 53 | color: #7f7f7f; 54 | color: rgba(0,0,0,0.5); 55 | } 56 | .quiet a { opacity: 0.7; } 57 | 58 | .fraction { 59 | font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; 60 | font-size: 10px; 61 | color: #555; 62 | background: #E8E8E8; 63 | padding: 4px 5px; 64 | border-radius: 3px; 65 | vertical-align: middle; 66 | } 67 | 68 | div.path a:link, div.path a:visited { color: #333; } 69 | table.coverage { 70 | border-collapse: collapse; 71 | margin: 10px 0 0 0; 72 | padding: 0; 73 | } 74 | 75 | table.coverage td { 76 | margin: 0; 77 | padding: 0; 78 | vertical-align: top; 79 | } 80 | table.coverage td.line-count { 81 | text-align: right; 82 | padding: 0 5px 0 20px; 83 | } 84 | table.coverage td.line-coverage { 85 | text-align: right; 86 | padding-right: 10px; 87 | min-width:20px; 88 | } 89 | 90 | table.coverage td span.cline-any { 91 | display: inline-block; 92 | padding: 0 5px; 93 | width: 100%; 94 | } 95 | .missing-if-branch { 96 | display: inline-block; 97 | margin-right: 5px; 98 | border-radius: 3px; 99 | position: relative; 100 | padding: 0 4px; 101 | background: #333; 102 | color: yellow; 103 | } 104 | 105 | .skip-if-branch { 106 | display: none; 107 | margin-right: 10px; 108 | position: relative; 109 | padding: 0 4px; 110 | background: #ccc; 111 | color: white; 112 | } 113 | .missing-if-branch .typ, .skip-if-branch .typ { 114 | color: inherit !important; 115 | } 116 | .coverage-summary { 117 | border-collapse: collapse; 118 | width: 100%; 119 | } 120 | .coverage-summary tr { border-bottom: 1px solid #bbb; } 121 | .keyline-all { border: 1px solid #ddd; } 122 | .coverage-summary td, .coverage-summary th { padding: 10px; } 123 | .coverage-summary tbody { border: 1px solid #bbb; } 124 | .coverage-summary td { border-right: 1px solid #bbb; } 125 | .coverage-summary td:last-child { border-right: none; } 126 | .coverage-summary th { 127 | text-align: left; 128 | font-weight: normal; 129 | white-space: nowrap; 130 | } 131 | .coverage-summary th.file { border-right: none !important; } 132 | .coverage-summary th.pct { } 133 | .coverage-summary th.pic, 134 | .coverage-summary th.abs, 135 | .coverage-summary td.pct, 136 | .coverage-summary td.abs { text-align: right; } 137 | .coverage-summary td.file { white-space: nowrap; } 138 | .coverage-summary td.pic { min-width: 120px !important; } 139 | .coverage-summary tfoot td { } 140 | 141 | .coverage-summary .sorter { 142 | height: 10px; 143 | width: 7px; 144 | display: inline-block; 145 | margin-left: 0.5em; 146 | background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; 147 | } 148 | .coverage-summary .sorted .sorter { 149 | background-position: 0 -20px; 150 | } 151 | .coverage-summary .sorted-desc .sorter { 152 | background-position: 0 -10px; 153 | } 154 | .status-line { height: 10px; } 155 | /* dark red */ 156 | .red.solid, .status-line.low, .low .cover-fill { background:#C21F39 } 157 | .low .chart { border:1px solid #C21F39 } 158 | /* medium red */ 159 | .cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE } 160 | /* light red */ 161 | .low, .cline-no { background:#FCE1E5 } 162 | /* light green */ 163 | .high, .cline-yes { background:rgb(230,245,208) } 164 | /* medium green */ 165 | .cstat-yes { background:rgb(161,215,106) } 166 | /* dark green */ 167 | .status-line.high, .high .cover-fill { background:rgb(77,146,33) } 168 | .high .chart { border:1px solid rgb(77,146,33) } 169 | 170 | 171 | .medium .chart { border:1px solid #666; } 172 | .medium .cover-fill { background: #666; } 173 | 174 | .cbranch-no { background: yellow !important; color: #111; } 175 | 176 | .cstat-skip { background: #ddd; color: #111; } 177 | .fstat-skip { background: #ddd; color: #111 !important; } 178 | .cbranch-skip { background: #ddd !important; color: #111; } 179 | 180 | span.cline-neutral { background: #eaeaea; } 181 | .medium { background: #eaeaea; } 182 | 183 | .cover-fill, .cover-empty { 184 | display:inline-block; 185 | height: 12px; 186 | } 187 | .chart { 188 | line-height: 0; 189 | } 190 | .cover-empty { 191 | background: white; 192 | } 193 | .cover-full { 194 | border-right: none !important; 195 | } 196 | pre.prettyprint { 197 | border: none !important; 198 | padding: 0 !important; 199 | margin: 0 !important; 200 | } 201 | .com { color: #999 !important; } 202 | .ignore-none { color: #999; font-weight: normal; } 203 | 204 | .wrapper { 205 | min-height: 100%; 206 | height: auto !important; 207 | height: 100%; 208 | margin: 0 auto -48px; 209 | } 210 | .footer, .push { 211 | height: 48px; 212 | } 213 | -------------------------------------------------------------------------------- /test/unit/coverage/lcov-report/components/AdminNav.vue.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for components/AdminNav.vue 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files / components AdminNav.vue 20 |

21 |
22 |
23 | 0% 24 | Statements 25 | 0/2 26 |
27 |
28 | 100% 29 | Branches 30 | 0/0 31 |
32 |
33 | 0% 34 | Functions 35 | 0/1 36 |
37 |
38 | 0% 39 | Lines 40 | 0/2 41 |
42 |
43 |
44 |
45 |

 46 | 
107 | 
1 47 | 2 48 | 3 49 | 4 50 | 5 51 | 6 52 | 7 53 | 8 54 | 9 55 | 10 56 | 11 57 | 12 58 | 13 59 | 14 60 | 15 61 | 16 62 | 17 63 | 18 64 | 19 65 | 20 66 | 21  67 |   68 |   69 |   70 |   71 |   72 |   73 |   74 |   75 |   76 |   77 |   78 |   79 |   80 |   81 |   82 |   83 |   84 |   85 |   86 |  
 
 87 | import eventHub from '~/plugins/eventsHub.js';
 88 |  
 89 | export default {
 90 |   props: {
 91 |     name: {
 92 |       type: String,
 93 |       default: 'User',
 94 |     },
 95 |     imageUrl: {
 96 |       type: String,
 97 |       default: '/default_profile_pic.jpg',
 98 |     },
 99 |   },
100 |   methods: {
101 |     logout: () => {
102 |       eventHub.$emit('logout');
103 |     },
104 |   },
105 | };
106 |  
108 |
109 |
110 | 114 | 115 | 116 | 123 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /test/unit/coverage/lcov-report/components/Button.story.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for components/Button.story.js 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files / components Button.story.js 20 |

21 |
22 |
23 | 0% 24 | Statements 25 | 0/9 26 |
27 |
28 | 0% 29 | Branches 30 | 0/4 31 |
32 |
33 | 0% 34 | Functions 35 | 0/4 36 |
37 |
38 | 0% 39 | Lines 40 | 0/7 41 |
42 |
43 |
44 |
45 |

 46 | 
122 | 
1 47 | 2 48 | 3 49 | 4 50 | 5 51 | 6 52 | 7 53 | 8 54 | 9 55 | 10 56 | 11 57 | 12 58 | 13 59 | 14 60 | 15 61 | 16 62 | 17 63 | 18 64 | 19 65 | 20 66 | 21 67 | 22 68 | 23 69 | 24 70 | 25 71 | 26  72 |   73 |   74 |   75 |   76 |   77 |   78 |   79 |   80 |   81 |   82 |   83 |   84 |   85 |   86 |   87 |   88 |   89 |   90 |   91 |   92 |   93 |   94 |   95 |   96 |  
import { storiesOf } from '@storybook/vue';
 97 | import { action } from '@storybook/addon-actions';
 98 | // import { linkTo } from '@storybook/addon-links';
 99 | // import { addonNotes } from '@storybook/addon-notes';
100 | // import { addonKnobs, text, number, boolean, array, select, color, date } from '@storybook/addon-knobs';
101 | import MyButton from './Button.vue';
102 |  
103 | storiesOf('MyButton', module)
104 |   // Works if Vue.component is called in the config.js in .storybook
105 |   .add('rounded', () => ({
106 |     components: { MyButton },
107 |     template: '<my-button :rounded="true">A Button with rounded edges</my-button>',
108 |   }))
109 |   .add('square', () => ({
110 |     components: { MyButton },
111 |     template: '<my-button :rounded="false">A Button with square edges</my-button>',
112 |   }))
113 |   .add('template + methods', () => ({
114 |     components: { MyButton },
115 |     template: `
116 |       <p>
117 |         <my-button :rounded="true" :handle-click="log">MyButton rendered in a template + props & methods</my-button>
118 |       </p>`,
119 |     methods: { log: action('log1') },
120 |   }));
121 |  
123 |
124 |
125 | 129 | 130 | 131 | 138 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /test/unit/coverage/lcov-report/components/Button.vue.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for components/Button.vue 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files / components Button.vue 20 |

21 |
22 |
23 | 50% 24 | Statements 25 | 1/2 26 |
27 |
28 | 100% 29 | Branches 30 | 0/0 31 |
32 |
33 | 50% 34 | Functions 35 | 1/2 36 |
37 |
38 | 100% 39 | Lines 40 | 1/1 41 |
42 |
43 |
44 |
45 |

 46 | 
 83 | 
1 47 | 2 48 | 3 49 | 4 50 | 5 51 | 6 52 | 7 53 | 8 54 | 9 55 | 10 56 | 11 57 | 12 58 | 13  59 |   60 |   61 |   62 |   63 | 4x 64 |   65 |   66 |   67 |   68 |   69 |   70 |  
 
 71 | export default {
 72 |   props: {
 73 |     rounded: Boolean,
 74 |     handleClick: {
 75 |       default: () => () => null,
 76 |     },
 77 |     color: {
 78 |       default: '#42b983',
 79 |     },
 80 |   },
 81 | };
 82 |  
84 |
85 |
86 | 90 | 91 | 92 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /test/unit/coverage/lcov-report/components/Footer.story.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for components/Footer.story.js 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files / components Footer.story.js 20 |

21 |
22 |
23 | 0% 24 | Statements 25 | 0/6 26 |
27 |
28 | 0% 29 | Branches 30 | 0/4 31 |
32 |
33 | 0% 34 | Functions 35 | 0/2 36 |
37 |
38 | 0% 39 | Lines 40 | 0/4 41 |
42 |
43 |
44 |
45 |

46 | 
74 | 
1 47 | 2 48 | 3 49 | 4 50 | 5 51 | 6 52 | 7 53 | 8 54 | 9 55 | 10  56 |   57 |   58 |   59 |   60 |   61 |   62 |   63 |   64 |  
import { storiesOf } from '@storybook/vue';
65 |  
66 | import MyFooter from './Footer.vue';
67 |  
68 | storiesOf('MyFooter', module)
69 |   .add('story as a component', () => ({
70 |     components: { MyFooter },
71 |     template: '<my-footer>story as a component</my-footer>',
72 |   }));
73 |  
75 |
76 |
77 | 81 | 82 | 83 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /test/unit/coverage/lcov-report/components/Footer.vue.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for components/Footer.vue 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files / components Footer.vue 20 |

21 |
22 |
23 | 0% 24 | Statements 25 | 0/13 26 |
27 |
28 | 0% 29 | Branches 30 | 0/6 31 |
32 |
33 | 0% 34 | Functions 35 | 0/2 36 |
37 |
38 | 0% 39 | Lines 40 | 0/13 41 |
42 |
43 |
44 |
45 |

46 | 
77 | 
1 47 | 2 48 | 3 49 | 4 50 | 5 51 | 6 52 | 7 53 | 8 54 | 9 55 | 10 56 | 11  57 |   58 |   59 |   60 |   61 |   62 |   63 |   64 |   65 |   66 |  
<template>
67 |   <footer>
68 |     Visit our website for more documentation : <a href="https://nuxtjs.org" target="_blank">nuxtjs.org</a>
69 |   </footer>
70 | </template>
71 | 
72 | <script>
73 | export default {
74 |  
75 | }
76 | </script>
78 |
79 |
80 | 84 | 85 | 86 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /test/unit/coverage/lcov-report/components/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for components 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files components 20 |

21 |
22 |
23 | 25% 24 | Statements 25 | 1/4 26 |
27 |
28 | 100% 29 | Branches 30 | 0/0 31 |
32 |
33 | 33.33% 34 | Functions 35 | 1/3 36 |
37 |
38 | 33.33% 39 | Lines 40 | 1/3 41 |
42 |
43 |
44 |
45 |
46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 |
FileStatementsBranchesFunctionsLines
AdminNav.vue
0%0/2100%0/00%0/10%0/2
Button.vue
50%1/2100%0/050%1/2100%1/1
89 |
90 |
91 | 95 | 96 | 97 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /test/unit/coverage/lcov-report/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for All files 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files 20 |

21 |
22 |
23 | 11.76% 24 | Statements 25 | 4/34 26 |
27 |
28 | 0% 29 | Branches 30 | 0/14 31 |
32 |
33 | 20% 34 | Functions 35 | 3/15 36 |
37 |
38 | 12.5% 39 | Lines 40 | 4/32 41 |
42 |
43 |
44 |
45 |
46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 |
FileStatementsBranchesFunctionsLines
components
25%1/4100%0/033.33%1/333.33%1/3
layouts
100%1/1100%0/0100%0/0100%1/1
pages
11.76%2/170%0/725%2/812.5%2/16
pages/admin
0%0/120%0/70%0/40%0/12
115 |
116 |
117 | 121 | 122 | 123 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /test/unit/coverage/lcov-report/layouts/default.vue.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for layouts/default.vue 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files / layouts default.vue 20 |

21 |
22 |
23 | 100% 24 | Statements 25 | 1/1 26 |
27 |
28 | 100% 29 | Branches 30 | 0/0 31 |
32 |
33 | 100% 34 | Functions 35 | 0/0 36 |
37 |
38 | 100% 39 | Lines 40 | 1/1 41 |
42 |
43 |
44 |
45 |

46 | 
71 | 
1 47 | 2 48 | 3 49 | 4 50 | 5 51 | 6 52 | 7 53 | 8 54 | 9  55 | 1x 56 |   57 |   58 |   59 |   60 |   61 |   62 |  
 
63 | import MyFooter from '~/components/Footer.vue';
64 |  
65 | export default {
66 |   components: {
67 |     MyFooter,
68 |   },
69 | };
70 |  
72 |
73 |
74 | 78 | 79 | 80 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /test/unit/coverage/lcov-report/layouts/error.vue.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for layouts/error.vue 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files / layouts error.vue 20 |

21 |
22 |
23 | 0% 24 | Statements 25 | 0/9 26 |
27 |
28 | 0% 29 | Branches 30 | 0/6 31 |
32 |
33 | 0% 34 | Functions 35 | 0/1 36 |
37 |
38 | 0% 39 | Lines 40 | 0/9 41 |
42 |
43 |
44 |
45 |

 46 | 
158 | 
1 47 | 2 48 | 3 49 | 4 50 | 5 51 | 6 52 | 7 53 | 8 54 | 9 55 | 10 56 | 11 57 | 12 58 | 13 59 | 14 60 | 15 61 | 16 62 | 17 63 | 18 64 | 19 65 | 20 66 | 21 67 | 22 68 | 23 69 | 24 70 | 25 71 | 26 72 | 27 73 | 28 74 | 29 75 | 30 76 | 31 77 | 32 78 | 33 79 | 34 80 | 35 81 | 36 82 | 37 83 | 38  84 |   85 |   86 |   87 |   88 |   89 |   90 |   91 |   92 |   93 |   94 |   95 |   96 |   97 |   98 |   99 |   100 |   101 |   102 |   103 |   104 |   105 |   106 |   107 |   108 |   109 |   110 |   111 |   112 |   113 |   114 |   115 |   116 |   117 |   118 |   119 |   120 |  
<template>
121 |   <section class="container">
122 |     <img src="../assets/img/logo.png" alt="Nuxt.js Logo" class="logo" />
123 |     <h1 class="title">
124 |       {{ error.statusCode }}
125 |     </h1>
126 |     <h2 class="info">
127 |       {{ error.message }}
128 |     </h2>
129 |     <nuxt-link class="button" to="/" v-if="error.statusCode === 404">
130 |       Homepage
131 |     </nuxt-link>
132 |   </section>
133 | </template>
134 | <script>
135 | export default {
136 |   props: ['error']
137 | }
138 | </script>
139 |  
140 | <style scoped>
141 | .title
142 | {
143 |   margin-top: 15px;
144 |   font-size: 5em;
145 | }
146 | .info
147 | {
148 |   font-weight: 300;
149 |   color: #9aabb1;
150 |   margin: 0;
151 | }
152 | .button
153 | {
154 |   margin-top: 50px;
155 | }
156 | </style>
157 |  
159 |
160 |
161 | 165 | 166 | 167 | 174 | 175 | 176 | 177 | -------------------------------------------------------------------------------- /test/unit/coverage/lcov-report/layouts/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for layouts 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files layouts 20 |

21 |
22 |
23 | 100% 24 | Statements 25 | 1/1 26 |
27 |
28 | 100% 29 | Branches 30 | 0/0 31 |
32 |
33 | 100% 34 | Functions 35 | 0/0 36 |
37 |
38 | 100% 39 | Lines 40 | 1/1 41 |
42 |
43 |
44 |
45 |
46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 |
FileStatementsBranchesFunctionsLines
default.vue
100%1/1100%0/0100%0/0100%1/1
76 |
77 |
78 | 82 | 83 | 84 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /test/unit/coverage/lcov-report/pages/_id.vue.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for pages/_id.vue 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files / pages _id.vue 20 |

21 |
22 |
23 | 0% 24 | Statements 25 | 0/6 26 |
27 |
28 | 100% 29 | Branches 30 | 0/0 31 |
32 |
33 | 0% 34 | Functions 35 | 0/4 36 |
37 |
38 | 0% 39 | Lines 40 | 0/5 41 |
42 |
43 |
44 |
45 |

 46 | 
 95 | 
1 47 | 2 48 | 3 49 | 4 50 | 5 51 | 6 52 | 7 53 | 8 54 | 9 55 | 10 56 | 11 57 | 12 58 | 13 59 | 14 60 | 15 61 | 16 62 | 17  63 |   64 |   65 |   66 |   67 |   68 |   69 |   70 |   71 |   72 |   73 |   74 |   75 |   76 |   77 |   78 |  
 
 79 | import axios from '~/plugins/axios.js';
 80 |  
 81 | export default {
 82 |   name: 'id',
 83 |   asyncData({ params, error }) {
 84 |     return axios.get(`/api/users/${params.id}`).then((res) => { return { user: res.data }; }).catch(() => {
 85 |       error({ statusCode: 404, message: 'User not found' });
 86 |     });
 87 |   },
 88 |   head() {
 89 |     return {
 90 |       title: `User: ${this.user.name}`,
 91 |     };
 92 |   },
 93 | };
 94 |  
96 |
97 |
98 | 102 | 103 | 104 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /test/unit/coverage/lcov-report/pages/admin/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for pages/admin 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files pages/admin 20 |

21 |
22 |
23 | 0% 24 | Statements 25 | 0/12 26 |
27 |
28 | 0% 29 | Branches 30 | 0/7 31 |
32 |
33 | 0% 34 | Functions 35 | 0/4 36 |
37 |
38 | 0% 39 | Lines 40 | 0/12 41 |
42 |
43 |
44 |
45 |
46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 |
FileStatementsBranchesFunctionsLines
index.vue
0%0/120%0/70%0/40%0/12
76 |
77 |
78 | 82 | 83 | 84 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /test/unit/coverage/lcov-report/pages/admin/index.vue.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for pages/admin/index.vue 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files / pages/admin index.vue 20 |

21 |
22 |
23 | 0% 24 | Statements 25 | 0/12 26 |
27 |
28 | 0% 29 | Branches 30 | 0/7 31 |
32 |
33 | 0% 34 | Functions 35 | 0/4 36 |
37 |
38 | 0% 39 | Lines 40 | 0/12 41 |
42 |
43 |
44 |
45 |

 46 | 
143 | 
1 47 | 2 48 | 3 49 | 4 50 | 5 51 | 6 52 | 7 53 | 8 54 | 9 55 | 10 56 | 11 57 | 12 58 | 13 59 | 14 60 | 15 61 | 16 62 | 17 63 | 18 64 | 19 65 | 20 66 | 21 67 | 22 68 | 23 69 | 24 70 | 25 71 | 26 72 | 27 73 | 28 74 | 29 75 | 30 76 | 31 77 | 32 78 | 33  79 |   80 |   81 |   82 |   83 |   84 |   85 |   86 |   87 |   88 |   89 |   90 |   91 |   92 |   93 |   94 |   95 |   96 |   97 |   98 |   99 |   100 |   101 |   102 |   103 |   104 |   105 |   106 |   107 |   108 |   109 |   110 |  
 
111 | import AdminNav from '~/components/AdminNav.vue';
112 | import eventHub from '~/plugins/eventsHub.js';
113 |  
114 | export default {
115 |   layout: 'admin',
116 |   components: {
117 |     AdminNav,
118 |   },
119 |   fetch({ store, redirect }) {
120 |     if (!store.state.user) {
121 |       return redirect('/');
122 |     }
123 |     return false;
124 |   },
125 |   methods: {
126 |     async logout() {
127 |       try {
128 |         await this.$store.dispatch('logout');
129 |         window.location.replace('/');
130 |       } catch (e) {
131 |       // eslint-disable-next-line
132 |         console.log(e);
133 |       }
134 |     },
135 |   },
136 |   mounted() {
137 |     eventHub.$on('logout', () => {
138 |       this.logout();
139 |     });
140 |   },
141 | };
142 |  
144 |
145 |
146 | 150 | 151 | 152 | 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /test/unit/coverage/lcov-report/pages/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for pages 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files pages 20 |

21 |
22 |
23 | 11.76% 24 | Statements 25 | 2/17 26 |
27 |
28 | 0% 29 | Branches 30 | 0/7 31 |
32 |
33 | 25% 34 | Functions 35 | 2/8 36 |
37 |
38 | 12.5% 39 | Lines 40 | 2/16 41 |
42 |
43 |
44 |
45 |
46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 |
FileStatementsBranchesFunctionsLines
_id.vue
0%0/6100%0/00%0/40%0/5
index.vue
18.18%2/110%0/750%2/418.18%2/11
89 |
90 |
91 | 95 | 96 | 97 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /test/unit/coverage/lcov-report/pages/index.vue.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for pages/index.vue 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |
17 |
18 |

19 | All files / pages index.vue 20 |

21 |
22 |
23 | 18.18% 24 | Statements 25 | 2/11 26 |
27 |
28 | 0% 29 | Branches 30 | 0/7 31 |
32 |
33 | 50% 34 | Functions 35 | 2/4 36 |
37 |
38 | 18.18% 39 | Lines 40 | 2/11 41 |
42 |
43 |
44 |
45 |

 46 | 
161 | 
1 47 | 2 48 | 3 49 | 4 50 | 5 51 | 6 52 | 7 53 | 8 54 | 9 55 | 10 56 | 11 57 | 12 58 | 13 59 | 14 60 | 15 61 | 16 62 | 17 63 | 18 64 | 19 65 | 20 66 | 21 67 | 22 68 | 23 69 | 24 70 | 25 71 | 26 72 | 27 73 | 28 74 | 29 75 | 30 76 | 31 77 | 32 78 | 33 79 | 34 80 | 35 81 | 36 82 | 37 83 | 38 84 | 39  85 |   86 |   87 |   88 |   89 |   90 |   91 |   92 |   93 |   94 | 1x 95 |   96 |   97 |   98 |   99 |   100 |   101 |   102 |   103 |   104 |   105 | 2x 106 |   107 |   108 |   109 |   110 |   111 |   112 |   113 |   114 |   115 |   116 |   117 |   118 |   119 |   120 |   121 |   122 |  
 
123 | // import axios from '~/plugins/axios';
124 |  
125 | export default {
126 |   head() {
127 |     return {
128 |       title: 'Log In',
129 |     };
130 |   },
131 |   data() {
132 |     return {
133 |       username: '',
134 |       password: '',
135 |     };
136 |   },
137 |   fetch({ store, redirect }) {
138 |     if (store.state.user) {
139 |       return redirect('/admin');
140 |     }
141 |     return false;
142 |   },
143 |   methods: {
144 |     async login() {
145 |       try {
146 |         await this.$store.dispatch('login', {
147 |           username: this.username,
148 |           password: this.password,
149 |         });
150 |         this.username = '';
151 |         this.password = '';
152 |         window.location.replace('/admin');
153 |       } catch (e) {
154 |         // eslint-disable-next-line
155 |         console.log(e);
156 |       }
157 |     },
158 |   },
159 | };
160 |  
162 |
163 |
164 | 168 | 169 | 170 | 177 | 178 | 179 | 180 | -------------------------------------------------------------------------------- /test/unit/coverage/lcov-report/prettify.css: -------------------------------------------------------------------------------- 1 | .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} 2 | -------------------------------------------------------------------------------- /test/unit/coverage/lcov-report/prettify.js: -------------------------------------------------------------------------------- 1 | window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); 2 | -------------------------------------------------------------------------------- /test/unit/coverage/lcov-report/sort-arrow-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itsMattShull/nuxt-starter-kit-v2/b18615b11fddea31c627df5e44eb37f5fcd55899/test/unit/coverage/lcov-report/sort-arrow-sprite.png -------------------------------------------------------------------------------- /test/unit/coverage/lcov-report/sorter.js: -------------------------------------------------------------------------------- 1 | var addSorting = (function () { 2 | "use strict"; 3 | var cols, 4 | currentSort = { 5 | index: 0, 6 | desc: false 7 | }; 8 | 9 | // returns the summary table element 10 | function getTable() { return document.querySelector('.coverage-summary'); } 11 | // returns the thead element of the summary table 12 | function getTableHeader() { return getTable().querySelector('thead tr'); } 13 | // returns the tbody element of the summary table 14 | function getTableBody() { return getTable().querySelector('tbody'); } 15 | // returns the th element for nth column 16 | function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; } 17 | 18 | // loads all columns 19 | function loadColumns() { 20 | var colNodes = getTableHeader().querySelectorAll('th'), 21 | colNode, 22 | cols = [], 23 | col, 24 | i; 25 | 26 | for (i = 0; i < colNodes.length; i += 1) { 27 | colNode = colNodes[i]; 28 | col = { 29 | key: colNode.getAttribute('data-col'), 30 | sortable: !colNode.getAttribute('data-nosort'), 31 | type: colNode.getAttribute('data-type') || 'string' 32 | }; 33 | cols.push(col); 34 | if (col.sortable) { 35 | col.defaultDescSort = col.type === 'number'; 36 | colNode.innerHTML = colNode.innerHTML + ''; 37 | } 38 | } 39 | return cols; 40 | } 41 | // attaches a data attribute to every tr element with an object 42 | // of data values keyed by column name 43 | function loadRowData(tableRow) { 44 | var tableCols = tableRow.querySelectorAll('td'), 45 | colNode, 46 | col, 47 | data = {}, 48 | i, 49 | val; 50 | for (i = 0; i < tableCols.length; i += 1) { 51 | colNode = tableCols[i]; 52 | col = cols[i]; 53 | val = colNode.getAttribute('data-value'); 54 | if (col.type === 'number') { 55 | val = Number(val); 56 | } 57 | data[col.key] = val; 58 | } 59 | return data; 60 | } 61 | // loads all row data 62 | function loadData() { 63 | var rows = getTableBody().querySelectorAll('tr'), 64 | i; 65 | 66 | for (i = 0; i < rows.length; i += 1) { 67 | rows[i].data = loadRowData(rows[i]); 68 | } 69 | } 70 | // sorts the table using the data for the ith column 71 | function sortByIndex(index, desc) { 72 | var key = cols[index].key, 73 | sorter = function (a, b) { 74 | a = a.data[key]; 75 | b = b.data[key]; 76 | return a < b ? -1 : a > b ? 1 : 0; 77 | }, 78 | finalSorter = sorter, 79 | tableBody = document.querySelector('.coverage-summary tbody'), 80 | rowNodes = tableBody.querySelectorAll('tr'), 81 | rows = [], 82 | i; 83 | 84 | if (desc) { 85 | finalSorter = function (a, b) { 86 | return -1 * sorter(a, b); 87 | }; 88 | } 89 | 90 | for (i = 0; i < rowNodes.length; i += 1) { 91 | rows.push(rowNodes[i]); 92 | tableBody.removeChild(rowNodes[i]); 93 | } 94 | 95 | rows.sort(finalSorter); 96 | 97 | for (i = 0; i < rows.length; i += 1) { 98 | tableBody.appendChild(rows[i]); 99 | } 100 | } 101 | // removes sort indicators for current column being sorted 102 | function removeSortIndicators() { 103 | var col = getNthColumn(currentSort.index), 104 | cls = col.className; 105 | 106 | cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); 107 | col.className = cls; 108 | } 109 | // adds sort indicators for current column being sorted 110 | function addSortIndicators() { 111 | getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted'; 112 | } 113 | // adds event listeners for all sorter widgets 114 | function enableUI() { 115 | var i, 116 | el, 117 | ithSorter = function ithSorter(i) { 118 | var col = cols[i]; 119 | 120 | return function () { 121 | var desc = col.defaultDescSort; 122 | 123 | if (currentSort.index === i) { 124 | desc = !currentSort.desc; 125 | } 126 | sortByIndex(i, desc); 127 | removeSortIndicators(); 128 | currentSort.index = i; 129 | currentSort.desc = desc; 130 | addSortIndicators(); 131 | }; 132 | }; 133 | for (i =0 ; i < cols.length; i += 1) { 134 | if (cols[i].sortable) { 135 | // add the click event handler on the th so users 136 | // dont have to click on those tiny arrows 137 | el = getNthColumn(i).querySelector('.sorter').parentElement; 138 | if (el.addEventListener) { 139 | el.addEventListener('click', ithSorter(i)); 140 | } else { 141 | el.attachEvent('onclick', ithSorter(i)); 142 | } 143 | } 144 | } 145 | } 146 | // adds sorting functionality to the UI 147 | return function () { 148 | if (!getTable()) { 149 | return; 150 | } 151 | cols = loadColumns(); 152 | loadData(cols); 153 | addSortIndicators(); 154 | enableUI(); 155 | }; 156 | })(); 157 | 158 | window.addEventListener('load', addSorting); 159 | -------------------------------------------------------------------------------- /test/unit/coverage/lcov.info: -------------------------------------------------------------------------------- 1 | TN: 2 | SF:/home/jefrydco/Projects/Github/nuxt-starter-kit-v2/components/AdminNav.vue 3 | FN:16,logout 4 | FNF:1 5 | FNH:0 6 | FNDA:0,logout 7 | DA:2,0 8 | DA:17,0 9 | LF:2 10 | LH:0 11 | BRF:0 12 | BRH:0 13 | end_of_record 14 | TN: 15 | SF:/home/jefrydco/Projects/Github/nuxt-starter-kit-v2/components/Button.vue 16 | FN:6,_default 17 | FN:6,(anonymous_1) 18 | FNF:2 19 | FNH:1 20 | FNDA:4,_default 21 | FNDA:0,(anonymous_1) 22 | DA:6,4 23 | LF:1 24 | LH:1 25 | BRF:0 26 | BRH:0 27 | end_of_record 28 | TN: 29 | SF:/home/jefrydco/Projects/Github/nuxt-starter-kit-v2/layouts/default.vue 30 | FNF:0 31 | FNH:0 32 | DA:2,1 33 | LF:1 34 | LH:1 35 | BRF:0 36 | BRH:0 37 | end_of_record 38 | TN: 39 | SF:/home/jefrydco/Projects/Github/nuxt-starter-kit-v2/pages/_id.vue 40 | FN:4,asyncData 41 | FN:7,(anonymous_2) 42 | FN:7,(anonymous_3) 43 | FN:4,head 44 | FNF:4 45 | FNH:0 46 | FNDA:0,asyncData 47 | FNDA:0,(anonymous_2) 48 | FNDA:0,(anonymous_3) 49 | FNDA:0,head 50 | DA:2,0 51 | DA:6,0 52 | DA:7,0 53 | DA:8,0 54 | DA:12,0 55 | LF:5 56 | LH:0 57 | BRF:0 58 | BRH:0 59 | end_of_record 60 | TN: 61 | SF:/home/jefrydco/Projects/Github/nuxt-starter-kit-v2/pages/index.vue 62 | FN:4,head 63 | FN:4,data 64 | FN:4,fetch 65 | FN:22,(anonymous_9) 66 | FNF:4 67 | FNH:2 68 | FNDA:0,head 69 | FNDA:1,data 70 | FNDA:0,fetch 71 | FNDA:1,(anonymous_9) 72 | DA:6,0 73 | DA:11,1 74 | DA:16,0 75 | DA:17,0 76 | DA:18,0 77 | DA:20,0 78 | DA:22,2 79 | DA:29,0 80 | DA:30,0 81 | DA:31,0 82 | DA:34,0 83 | LF:11 84 | LH:2 85 | BRDA:17,0,0,0 86 | BRDA:17,0,1,0 87 | BRDA:22,1,0,0 88 | BRDA:22,1,1,0 89 | BRDA:22,1,2,0 90 | BRDA:22,1,3,0 91 | BRDA:22,1,4,0 92 | BRF:7 93 | BRH:0 94 | end_of_record 95 | TN: 96 | SF:/home/jefrydco/Projects/Github/nuxt-starter-kit-v2/pages/admin/index.vue 97 | FN:5,fetch 98 | FN:16,(anonymous_8) 99 | FN:5,mounted 100 | FN:28,(anonymous_13) 101 | FNF:4 102 | FNH:0 103 | FNDA:0,fetch 104 | FNDA:0,(anonymous_8) 105 | FNDA:0,mounted 106 | FNDA:0,(anonymous_13) 107 | DA:2,0 108 | DA:3,0 109 | DA:10,0 110 | DA:11,0 111 | DA:12,0 112 | DA:14,0 113 | DA:16,0 114 | DA:20,0 115 | DA:23,0 116 | DA:27,0 117 | DA:28,0 118 | DA:29,0 119 | LF:12 120 | LH:0 121 | BRDA:11,0,0,0 122 | BRDA:11,0,1,0 123 | BRDA:16,1,0,0 124 | BRDA:16,1,1,0 125 | BRDA:16,1,2,0 126 | BRDA:16,1,3,0 127 | BRDA:16,1,4,0 128 | BRF:7 129 | BRH:0 130 | end_of_record 131 | -------------------------------------------------------------------------------- /test/unit/jest.conf.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | 3 | module.exports = { 4 | rootDir: path.resolve(__dirname, "../../"), 5 | testURL: "http://localhost", 6 | moduleNameMapper: { 7 | "^~/(.*)$": "/$1" 8 | }, 9 | verbose: true, 10 | transform: { 11 | ".*?\\.vue$": "/node_modules/jest-vue-preprocessor", 12 | ".*": "babel-jest" 13 | }, 14 | moduleFileExtensions: ["vue", "js", "jsx", "json", "node"], 15 | snapshotSerializers: ["/node_modules/jest-serializer-vue"], 16 | testPathIgnorePatterns: [ 17 | "/test/e2e", 18 | "/components/*.vue", 19 | "/node_modules" 20 | ], 21 | transformIgnorePatterns: ["/node_modules/(?!(@storybook/.*\\.vue$))"], 22 | testRegex: "(/__tests__/.*|\\.(test|spec))\\.(ts|js)$", 23 | coverageDirectory: "/test/unit/coverage", 24 | collectCoverageFrom: [ 25 | "components/**/*.{js,ts,vue}", 26 | "layouts/**/*.{js,ts,vue}", 27 | "pages/**/*.{js,ts,vue}", 28 | "!**/node_modules/**", 29 | "!components/**/*.story.js" 30 | ] 31 | }; 32 | -------------------------------------------------------------------------------- /test/unit/specs/components/Button.spec.js: -------------------------------------------------------------------------------- 1 | import { shallowMount } from "@vue/test-utils"; 2 | import Component from "~/components/Button.vue"; 3 | 4 | describe("Component Button", () => { 5 | it("renders to a snapshot", () => { 6 | const wrapper = shallowMount(Component); 7 | expect(wrapper.element).toMatchSnapshot(); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /test/unit/specs/components/Footer.spec.js: -------------------------------------------------------------------------------- 1 | import { shallowMount } from "@vue/test-utils"; 2 | import Component from "~/components/Footer.vue"; 3 | 4 | describe("Component Footer", () => { 5 | it("renders to a snapshot", () => { 6 | const wrapper = shallowMount(Component); 7 | expect(wrapper.element).toMatchSnapshot(); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /test/unit/specs/components/__snapshots__/Button.spec.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Component Button renders to a snapshot 1`] = ` 4 | 10 | `; 11 | -------------------------------------------------------------------------------- /test/unit/specs/components/__snapshots__/Footer.spec.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Component Footer renders to a snapshot 1`] = ` 4 | 14 | `; 15 | -------------------------------------------------------------------------------- /test/unit/specs/layouts/__snapshots__/default.spec.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Component Button renders to a snapshot 1`] = ` 4 |
5 | 6 | 7 | 8 |
9 | `; 10 | -------------------------------------------------------------------------------- /test/unit/specs/layouts/default.spec.js: -------------------------------------------------------------------------------- 1 | import { shallowMount } from "@vue/test-utils"; 2 | import Layout from "~/layouts/default.vue"; 3 | 4 | describe("Component Button", () => { 5 | it("renders to a snapshot", () => { 6 | const wrapper = shallowMount(Layout, { 7 | stubs: ["nuxt"] 8 | }); 9 | expect(wrapper.element).toMatchSnapshot(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /test/unit/specs/pages/__snapshots__/index.spec.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Page / renders to a snapshot 1`] = ` 4 |
7 |
8 |
11 | 16 | 17 | 22 |
23 | 24 |
27 | 32 | 33 | 37 |
38 | 39 |
42 | 46 |
47 |
48 |
49 | `; 50 | -------------------------------------------------------------------------------- /test/unit/specs/pages/index.spec.js: -------------------------------------------------------------------------------- 1 | import { shallowMount } from "@vue/test-utils"; 2 | import Page from "~/pages/index.vue"; 3 | 4 | describe("Page /", () => { 5 | it("renders to a snapshot", () => { 6 | const wrapper = shallowMount(Page); 7 | expect(wrapper.element).toMatchSnapshot(); 8 | }); 9 | }); 10 | 11 | // const localVue = createLocalVue(); 12 | 13 | // localVue.use(Vuex); 14 | 15 | // describe('Page homepage', () => { 16 | // let store; 17 | // const mockLogo = 'mock logo'; 18 | 19 | // beforeEach(() => { 20 | // store = new Vuex.Store({ 21 | // actions: { 22 | // 'logo/logoAction': jest.fn(), 23 | // }, 24 | // getters: { 25 | // 'logo/logo': () => mockLogo, 26 | // }, 27 | // }); 28 | // }); 29 | 30 | // it('should mock store correctly', () => { 31 | // const wrapper = shallow(Page, { store, localVue }); 32 | // expect(wrapper.vm.logo).toEqual(mockLogo); 33 | // }); 34 | // }); 35 | -------------------------------------------------------------------------------- /test/unit/storyshots.test.js: -------------------------------------------------------------------------------- 1 | import path from 'path'; 2 | import initStoryshots, { multiSnapshotWithOptions } from '@storybook/addon-storyshots'; 3 | 4 | initStoryshots({ 5 | framework: 'vue', 6 | configPath: path.join(__dirname, '../../.storybook'), 7 | test: multiSnapshotWithOptions({}), 8 | }); 9 | --------------------------------------------------------------------------------