diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1049aaccd..1efaf19d2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -344,7 +344,7 @@ jobs: report_name: Coverage Frontend type: lcov result_path: ./coverage/lcov.info - min_coverage: 76 + min_coverage: 82 token: ${{ github.token }} ############################################################################## diff --git a/frontend/package.json b/frontend/package.json index ff574e078..b5c7868b7 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -55,7 +55,6 @@ "nouislider": "^12.1.0", "particles-bg-vue": "1.2.3", "perfect-scrollbar": "^1.3.0", - "portal-vue": "^2.1.7", "prettier": "^2.2.1", "qrcode": "^1.4.4", "quill": "^1.3.6", diff --git a/frontend/src/plugins/dashboard-plugin.js b/frontend/src/plugins/dashboard-plugin.js index 448675d20..892a2d93c 100755 --- a/frontend/src/plugins/dashboard-plugin.js +++ b/frontend/src/plugins/dashboard-plugin.js @@ -1,10 +1,7 @@ -import '@/polyfills' import GlobalComponents from './globalComponents' import GlobalDirectives from './globalDirectives' import SideBar from '@/components/SidebarPlugin' -import PortalVue from 'portal-vue' - import Toasted from 'vue-toasted' // vue-bootstrap @@ -32,7 +29,6 @@ export default { Vue.use(GlobalComponents) Vue.use(GlobalDirectives) Vue.use(SideBar) - Vue.use(PortalVue) Vue.use(BootstrapVue) Vue.use(IconsPlugin) Vue.use(VueMoment) diff --git a/frontend/src/polyfills.js b/frontend/src/polyfills.js deleted file mode 100644 index a743ee3e3..000000000 --- a/frontend/src/polyfills.js +++ /dev/null @@ -1,96 +0,0 @@ -/* eslint-disable */ -import 'es6-promise/auto' - -export default (function initPollyFills () { - if (!Array.prototype.find) { - Object.defineProperty(Array.prototype, 'find', { - value: function (predicate) { - // 1. Let O be ? ToObject(this value). - if (this == null) { - throw new TypeError('"this" is null or not defined'); - } - - var o = Object(this); - - // 2. Let len be ? ToLength(? Get(O, "length")). - var len = o.length >>> 0; - - // 3. If IsCallable(predicate) is false, throw a TypeError exception. - if (typeof predicate !== 'function') { - throw new TypeError('predicate must be a function'); - } - - // 4. If thisArg was supplied, let T be thisArg; else let T be undefined. - var thisArg = arguments[1]; - - // 5. Let k be 0. - var k = 0; - - // 6. Repeat, while k < len - while (k < len) { - // a. Let Pk be ! ToString(k). - // b. Let kValue be ? Get(O, Pk). - // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). - // d. If testResult is true, return kValue. - var kValue = o[k]; - if (predicate.call(thisArg, kValue, k, o)) { - return kValue; - } - // e. Increase k by 1. - k++; - } - - // 7. Return undefined. - return undefined; - } - }); - } - if (typeof Object.assign !== 'function') { - // Must be writable: true, enumerable: false, configurable: true - Object.defineProperty(Object, "assign", { - value: function assign (target, varArgs) { // .length of function is 2 - 'use strict'; - if (target == null) { // TypeError if undefined or null - throw new TypeError('Cannot convert undefined or null to object'); - } - - var to = Object(target); - - for (var index = 1; index < arguments.length; index++) { - var nextSource = arguments[index]; - - if (nextSource != null) { // Skip over if undefined or null - for (var nextKey in nextSource) { - // Avoid bugs when hasOwnProperty is shadowed - if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { - to[nextKey] = nextSource[nextKey]; - } - } - } - } - return to; - }, - writable: true, - configurable: true - }); - } - if (!String.prototype.startsWith) { - String.prototype.startsWith = function(search, pos) { - return this.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; - }; - } - if (!String.prototype.includes) { - String.prototype.includes = function(search, start) { - 'use strict'; - if (typeof start !== 'number') { - start = 0; - } - - if (start + search.length > this.length) { - return false; - } else { - return this.indexOf(search, start) !== -1; - } - }; - } -}()) diff --git a/frontend/src/util/throttle.js b/frontend/src/util/throttle.js deleted file mode 100644 index d035cb748..000000000 --- a/frontend/src/util/throttle.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Simple throttle function that executes a passed function only once in the specified timeout - * @param handlerFunc - * @param [timeout] the throttle interval - */ -export function throttle(handlerFunc, timeout = 66) { - let resizeTimeout - if (!resizeTimeout) { - resizeTimeout = setTimeout(() => { - resizeTimeout = null - handlerFunc() - // The actualResizeHandler will execute at a rate of 15fps - }, timeout) - } -} diff --git a/frontend/src/views/Layout/AuthLayout_gdd.spec.js b/frontend/src/views/Layout/AuthLayout_gdd.spec.js new file mode 100644 index 000000000..aa05b772a --- /dev/null +++ b/frontend/src/views/Layout/AuthLayout_gdd.spec.js @@ -0,0 +1,51 @@ +import { mount } from '@vue/test-utils' +import AuthLayoutGdd from './AuthLayout_gdd' + +const localVue = global.localVue + +describe('AuthLayoutGdd', () => { + let wrapper + + const mocks = { + $i18n: { + locale: 'en', + }, + $t: jest.fn((t) => t), + $route: { + meta: { + hideFooter: false, + }, + }, + $store: { + state: {}, + commit: jest.fn(), + }, + } + + const stubs = { + // RouterLink: RouterLinkStub, + RouterView: true, + } + + const Wrapper = () => { + return mount(AuthLayoutGdd, { localVue, mocks, stubs }) + } + + describe('mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('has no sidebar', () => { + expect(wrapper.find('nav#sidenav-main').exists()).not.toBeTruthy() + }) + + it('has a main content div', () => { + expect(wrapper.find('div.main-content').exists()).toBeTruthy() + }) + + it('has a footer inside the main content', () => { + expect(wrapper.find('div.main-content').find('footer.footer').exists()).toBeTruthy() + }) + }) +}) diff --git a/frontend/src/views/NotFoundPage.spec.js b/frontend/src/views/NotFoundPage.spec.js new file mode 100644 index 000000000..709b24807 --- /dev/null +++ b/frontend/src/views/NotFoundPage.spec.js @@ -0,0 +1,22 @@ +import { mount } from '@vue/test-utils' +import NotFoundPage from './NotFoundPage' + +const localVue = global.localVue + +describe('NotFoundPage', () => { + let wrapper + + const Wrapper = () => { + return mount(NotFoundPage, { localVue }) + } + + describe('mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('has a svg', () => { + expect(wrapper.find('svg').exists()).toBeTruthy() + }) + }) +})