FIX - linting errors for the build
| | |
| | | { |
| | | "root": true, |
| | | "extends": [ |
| | | "plugin:vue/essential", |
| | | "@vue/prettier" |
| | | ], |
| | | "extends": ["plugin:vue/essential", "@vue/prettier"], |
| | | "env": { |
| | | "es6": true, |
| | | "node": true |
| | | }, |
| | | "ecmaFeatures": { |
| | | "modules": true |
| | | } |
| | | } |
| | | }, |
| | | "rules": { "no-unused-vars": 0 } |
| | | } |
| | |
| | | module.exports = { |
| | | moduleFileExtensions: [ |
| | | "js", |
| | | "jsx", |
| | | "json", |
| | | "vue" |
| | | ], |
| | | moduleFileExtensions: ["js", "jsx", "json", "vue"], |
| | | transform: { |
| | | "^.+\\.vue$": "vue-jest", |
| | | "^.+\\.jsx?$": "babel-jest" |
| | |
| | | "!src/**/*.test.{js,jsx}", |
| | | "!<rootDir>/node_modules/" |
| | | ], |
| | | testResultsProcessor: './node_modules/jest-junit-reporter', |
| | | coverageDirectory: './reports/coverage', |
| | | coverageReporters: [ |
| | | "text", |
| | | "html", |
| | | "clover" |
| | | ] |
| | | } |
| | | testResultsProcessor: "./node_modules/jest-junit-reporter", |
| | | coverageDirectory: "./reports/coverage", |
| | | coverageReporters: ["text", "html", "clover"] |
| | | }; |
| | |
| | | src_folders: [ |
| | | "tests/e2e/specs" // Where you are storing your Nightwatch e2e tests |
| | | ], |
| | | // TODO - move to the package.json |
| | | // TODO - move to the package.json |
| | | // urlToTest: process.env.E2E_ENV ? `http://app-name-labs-${process.env.E2E_ENV}.apps.company-xyz.rht-labs.com`: "http://localhost:8080", |
| | | output_folder: "./reports/e2e", |
| | | selenium: { |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | |
| | | function padLeft (count) { // theregister.co.uk/2016/03/23/npm_left_pad_chaos/ |
| | | return count < 10 ? "0" + count: count.toString(); |
| | | function padLeft(count) { |
| | | // theregister.co.uk/2016/03/23/npm_left_pad_chaos/ |
| | | return count < 10 ? "0" + count : count.toString(); |
| | | } |
| | | |
| | | var FILECOUNT = 0; // global screenshot file count |
| | |
| | | * While we"re at it, we are adding some meta-data to the filename, specifically |
| | | * the Platform/Browser where the test was run and the test (file) name. |
| | | */ |
| | | function imgpath (browser) { |
| | | function imgpath(browser) { |
| | | var a = browser.options.desiredCapabilities; |
| | | var meta = [a.platform]; |
| | | meta.push(a.browserName ? a.browserName: "any"); |
| | | meta.push(a.version ? a.version: "any"); |
| | | meta.push(a.browserName ? a.browserName : "any"); |
| | | meta.push(a.version ? a.version : "any"); |
| | | meta.push(a.name); // this is the test filename so always exists. |
| | | var metadata = meta.join("~").toLowerCase().replace(/ /g, ""); |
| | | var metadata = meta |
| | | .join("~") |
| | | .toLowerCase() |
| | | .replace(/ /g, ""); |
| | | return SCREENSHOT_PATH + metadata + "_" + padLeft(FILECOUNT++) + "_"; |
| | | } |
| | | |
| | | module.exports.imgpath = imgpath; |
| | | module.exports.SCREENSHOT_PATH = SCREENSHOT_PATH; |
| | | module.exports.SCREENSHOT_PATH = SCREENSHOT_PATH; |
| | |
| | | </template> |
| | | |
| | | <style lang="scss"> |
| | | |
| | | @import "scss/custom.scss"; |
| | | |
| | | #app { |
| | |
| | | }, |
| | | { |
| | | name: "Inside a Residency Blog", |
| | | url: "https://developers.redhat.com/blog/2018/01/26/part-1-inside-open-innovation-labs-residency/" |
| | | url: |
| | | "https://developers.redhat.com/blog/2018/01/26/part-1-inside-open-innovation-labs-residency/" |
| | | } |
| | | ], |
| | | social: [ |
| | | { |
| | | name: "YouTube", |
| | | url: |
| | | "https://www.youtube.com/watch?v=RxOKoqpDuIA" |
| | | url: "https://www.youtube.com/watch?v=RxOKoqpDuIA" |
| | | }, |
| | | { |
| | | name: "Twitter", |
| | | url: |
| | | "https://twitter.com/redhatlabs?lang=en" |
| | | url: "https://twitter.com/redhatlabs?lang=en" |
| | | } |
| | | ] |
| | | }; |
| | |
| | | a { |
| | | color: #a30000; |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | left: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | background: rgba(0,0,0,0.2); /* fallback for old browsers */ |
| | | background: rgba(0, 0, 0, 0.2); /* fallback for old browsers */ |
| | | // border-radius: 6px 6px 0 0; |
| | | } |
| | | time { |
| | |
| | | |
| | | <!-- Add "scoped" attribute to limit CSS to this component only --> |
| | | <style scoped lang="scss"> |
| | | |
| | | </style> |
| | |
| | | |
| | | <!-- Add "scoped" attribute to limit CSS to this component only --> |
| | | <style scoped lang="scss"> |
| | | |
| | | </style> |
| | |
| | | }, |
| | | methods: { |
| | | markCompleted() { |
| | | this.$store.dispatch("updateTodo", {id :this.todoItem._id}); |
| | | this.$store.dispatch("updateTodo", { id: this.todoItem._id }); |
| | | console.info("INFO - Mark todo as completed ", this.todoItem.completed); |
| | | }, |
| | | markImportant() { |
| | |
| | | export default { |
| | | todoEndpoint: "http://todolist-api-<YOUR_NAME>-dev.apps.somedomain.com/api/todos" |
| | | todoEndpoint: |
| | | "http://todolist-api-<YOUR_NAME>-dev.apps.somedomain.com/api/todos" |
| | | }; |
| | |
| | | export default { |
| | | todoEndpoint: "http://todolist-api-<YOUR_NAME>-test.apps.somedomain.com/api/todos" |
| | | todoEndpoint: |
| | | "http://todolist-api-<YOUR_NAME>-test.apps.somedomain.com/api/todos" |
| | | }; |
| | |
| | | MARK_TODO_COMPLETED(state, index) { |
| | | console.log("INFO - MARK_TODO_COMPLETED"); |
| | | state.todos[index].completed = !state.todos[index].completed; |
| | | }, |
| | | } |
| | | }; |
| | |
| | | export default { |
| | | name: "ComponentView", |
| | | data() { |
| | | return { |
| | | |
| | | } |
| | | return {}; |
| | | } |
| | | }; |
| | | </script> |
| | |
| | | padding-top: 20px; |
| | | } |
| | | </style> |
| | | |
| | |
| | | import NewTodo from "@/components/NewTodo.vue"; |
| | | import ListOfTodos from "@/components/ListOfTodos.vue"; |
| | | import XofYItems from "@/components/XofYItems.vue"; |
| | | import { mapMutations } from 'vuex' |
| | | import { mapMutations } from "vuex"; |
| | | |
| | | export default { |
| | | name: "Todo", |
| | |
| | | XofYItems |
| | | }, |
| | | methods: { |
| | | ...mapMutations([ |
| | | 'editTodo', |
| | | 'toggleTodo', |
| | | 'deleteTodo' |
| | | ]), |
| | | }, |
| | | ...mapMutations(["editTodo", "toggleTodo", "deleteTodo"]) |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | |
| | | it("should call MARK_TODO_IMPORTANT", done => { |
| | | const commit = sinon.spy(); |
| | | state.todos = todos; |
| | | actions.updateTodo({ commit, state }, { id: 1 , important: true }).then(() => { |
| | | // TODO - test goes here! |
| | | |
| | | done(); |
| | | }); |
| | | actions |
| | | .updateTodo({ commit, state }, { id: 1, important: true }) |
| | | .then(() => { |
| | | // TODO - test goes here! |
| | | |
| | | done(); |
| | | }); |
| | | }); |
| | | }); |
| | |
| | | it("it should MARK_TODO_IMPORTANT as false", () => { |
| | | state.todos = importantTodos; |
| | | // TODO - test goes here! |
| | | |
| | | }); |
| | | |
| | | it("it should MARK_TODO_IMPORTANT as true", () => { |
| | | state.todos = importantTodos; |
| | | // TODO - test goes here! |
| | | |
| | | }); |
| | | }); |
| | |
| | | import Vue from 'vue' |
| | | import Vue from "vue"; |
| | | |
| | | Vue.config.productionTip = false |
| | | Vue.config.productionTip = false; |
| | | import VueMaterial from "vue-material"; |
| | | // import "vue-material/dist/vue-material.min.css"; |
| | | Vue.use(VueMaterial); |
| | |
| | | import * as all from "../setup.js"; |
| | | |
| | | describe("Header.vue", () => { |
| | | |
| | | // const Date = 15 / 12 / 1995; |
| | | // it("has the expected html structure", () => { |
| | | // const created = () => {} |
| | | // const wrapper = shallow(Header, { |
| | | // created |
| | | // }); |
| | | // expect(wrapper.element).toMatchSnapshot(); |
| | | // }); |
| | | // const Date = 15 / 12 / 1995; |
| | | // it("has the expected html structure", () => { |
| | | // const created = () => {} |
| | | // const wrapper = shallow(Header, { |
| | | // created |
| | | // }); |
| | | // expect(wrapper.element).toMatchSnapshot(); |
| | | // }); |
| | | |
| | | it("calls the loadTodos function from actionsjs when created", () => { |
| | | const created = jest.fn(); |
| | |
| | | ]; |
| | | const actions = { |
| | | loadTodos: jest.fn() |
| | | } |
| | | }; |
| | | const getters = { |
| | | todos: jest.fn() |
| | | } |
| | | }; |
| | | beforeEach(() => { |
| | | |
| | | store = new Vuex.Store({ |
| | | state: {}, |
| | | propsData: { todos }, |
| | | actions, getters |
| | | actions, |
| | | getters |
| | | }); |
| | | }); |
| | | |
| | | it("calls the loadTodos function from actionsjs when created", () => { |
| | | const wrapper = shallow(ListOfTodos, { store, localVue }); |
| | | expect(actions.loadTodos).toHaveBeenCalled(); |
| | | }) |
| | | }); |
| | | |
| | | it("maps getters with todos when computed", () => { |
| | | const wrapper = shallow(ListOfTodos, { store, localVue }); |
| | | expect(getters.todos).toHaveBeenCalled(); |
| | | }) |
| | | }); |
| | | |
| | | it("has the expected html structure", () => { |
| | | const wrapper = shallow(ListOfTodos, { store, localVue }); |
| | |
| | | import { shallow, createLocalVue, mount } from "@vue/test-utils"; |
| | | import Vuex from 'vuex'; |
| | | import Vuex from "vuex"; |
| | | import NewTodo from "@/components/NewTodo.vue"; |
| | | // import { expect } from 'chai' |
| | | |
| | | import * as all from "../setup.js"; |
| | | |
| | | const localVue = createLocalVue() |
| | | const localVue = createLocalVue(); |
| | | |
| | | localVue.use(Vuex) |
| | | localVue.use(Vuex); |
| | | |
| | | describe("NewTodo.vue", () => { |
| | | let methods; |
| | | let store; |
| | | |
| | | beforeEach(() => { |
| | | methods = { |
| | | (methods = { |
| | | newTodoAdded: jest.fn() |
| | | }, |
| | | store = new Vuex.Store({ |
| | | state: {}, |
| | | methods |
| | | }) |
| | | }), |
| | | (store = new Vuex.Store({ |
| | | state: {}, |
| | | methods |
| | | })); |
| | | }); |
| | | |
| | | it("calls newTodoAdded() when keyup.enter hit.", () => { |
| | | // time to try and test some vuex stuff and see if the methods are called when expected. |
| | | const wrapper = shallow(NewTodo, { methods , localVue}) |
| | | const wrapper = shallow(NewTodo, { methods, localVue }); |
| | | const input = wrapper.find(".md-input"); |
| | | input.trigger('keyup.enter') |
| | | expect(methods.newTodoAdded).toHaveBeenCalled() |
| | | input.trigger("keyup.enter"); |
| | | expect(methods.newTodoAdded).toHaveBeenCalled(); |
| | | }); |
| | | |
| | | it("does not call newTodoAdded() when keyup.space hit.", () => { |
| | | // time to try and test some vuex stuff and see if the methods are called when expected. |
| | | const wrapper = shallow(NewTodo, { methods , localVue}) |
| | | const wrapper = shallow(NewTodo, { methods, localVue }); |
| | | const input = wrapper.find(".md-input"); |
| | | input.trigger('keyup.space') |
| | | expect(methods.newTodoAdded).not.toHaveBeenCalled() |
| | | input.trigger("keyup.space"); |
| | | expect(methods.newTodoAdded).not.toHaveBeenCalled(); |
| | | }); |
| | | |
| | | it("renders props.placeholderMsg when passed", () => { |
| | |
| | | expect(wrapper.find(XofYItems)).toBeTruthy(); |
| | | }); |
| | | // NEW TEST GOES HERE |
| | | |
| | | }); |
| | |
| | | important: false |
| | | } |
| | | ]; |
| | | // const methods = { |
| | | // sumDoneTodoItems: jest.fn() |
| | | // }; |
| | | // const methods = { |
| | | // sumDoneTodoItems: jest.fn() |
| | | // }; |
| | | const actions = { |
| | | loadTodos: jest.fn(), |
| | | clearTodos: jest.fn() |
| | |
| | | } |
| | | ]; |
| | | |
| | | expect(mockedTodos.length).toEqual(3) |
| | | expect(mockedTodos.length).toEqual(3); |
| | | // Replace with testing the sumDoneTodoItems function and check it it's called |
| | | // expect(sumDoneTodoItems).toHaveBeenCalled() |
| | | }); |