From 5fd5a5be4ad428c1506e20abfe5ed441914450dc Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Wed, 20 Oct 2021 13:57:32 +0200 Subject: [PATCH] Add new test for instruments page, start refactor and style changes --- client/build/webpack.base.conf.js | 10 ++-- client/cypress/fixtures/mocks.js | 8 ++++ .../frontend/instruments-page.spec.js | 12 ++++- client/package-lock.json | 14 ++++++ .../components/instruments/FilterGroup.vue | 25 ++++++++++ .../instruments/InstrumentFilter.vue | 48 +++++++++++-------- client/src/pages/instrumentOverview.vue | 25 ++-------- 7 files changed, 96 insertions(+), 46 deletions(-) create mode 100644 client/src/components/instruments/FilterGroup.vue diff --git a/client/build/webpack.base.conf.js b/client/build/webpack.base.conf.js index b70630b9..81b79aca 100644 --- a/client/build/webpack.base.conf.js +++ b/client/build/webpack.base.conf.js @@ -2,7 +2,7 @@ const path = require('path'); const config = require('../config'); -const VueLoaderPlugin = require('vue-loader/lib/plugin'); +const {VueLoaderPlugin} = require('vue-loader'); const {isDev, styleRule, assetsPath} = require('./utils'); @@ -42,7 +42,7 @@ module.exports = { alias: { '@': resolve('src'), styles: resolve('src/styles'), - gql: resolve('src/graphql/gql') + gql: resolve('src/graphql/gql'), }, }, module: { @@ -64,9 +64,9 @@ module.exports = { test: /\.tsx?$/, loader: 'ts-loader', options: { - appendTsSuffixTo: [/\.vue$/] + appendTsSuffixTo: [/\.vue$/], }, - exclude: /node_modules/ + exclude: /node_modules/, }, { test: /\.js$/, @@ -79,7 +79,7 @@ module.exports = { { test: /\.(gql|graphql)$/, loader: 'graphql-tag/loader', - exclude: /node_modules/ + exclude: /node_modules/, }, { test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, diff --git a/client/cypress/fixtures/mocks.js b/client/cypress/fixtures/mocks.js index f66111a1..61cddee1 100644 --- a/client/cypress/fixtures/mocks.js +++ b/client/cypress/fixtures/mocks.js @@ -20,11 +20,13 @@ const classMemberIdIterator = idGenerator('ClassMemberNode'); const chapterIdIterator = idGenerator('ChapterNode'); const moduleIdIterator = idGenerator('ModuleNode'); const contentBlockIdIterator = idGenerator('ContentBlockNode'); +const instrumentIdGenerator = idGenerator('InstrumentNode'); const getClassMemberId = () => classMemberIdIterator.next().value; const getChapterId = () => chapterIdIterator.next().value; const getModuleId = () => moduleIdIterator.next().value; const getContentBlockId = () => contentBlockIdIterator.next().value; +const getInstrumentId = () => instrumentIdGenerator.next().value; export default { UUID: () => '123-456-789', @@ -109,4 +111,10 @@ export default { title: 'A Room Entry', contents: [], }), + InstrumentNode: () => ({ + contents: [], + title: 'instrument-title', + slug: 'instrument-slug', + id: getInstrumentId(), + }) }; diff --git a/client/cypress/integration/frontend/instruments-page.spec.js b/client/cypress/integration/frontend/instruments-page.spec.js index 1a7cfa19..66e15e2b 100644 --- a/client/cypress/integration/frontend/instruments-page.spec.js +++ b/client/cypress/integration/frontend/instruments-page.spec.js @@ -8,10 +8,20 @@ describe('Instruments Page', () => { operations: { MeQuery: {}, InstrumentsQuery: { - instruments: [] + instruments: [ + {}, + {} + ] } } }); cy.visit('instruments/'); + + cy.getByDataCy('filter-all-instruments').should('exist'); + cy.getByDataCy('filter-language-communication').should('exist'); + cy.getByDataCy('filter-society').should('exist'); + cy.getByDataCy('filter-interdisciplinary').should('exist'); + cy.getByDataCy('filter-analysis').should('exist'); + cy.getByDataCy('filter-ethics').should('exist'); }); }); diff --git a/client/package-lock.json b/client/package-lock.json index d8001d86..723c1d84 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -18294,6 +18294,13 @@ "integrity": "sha512-q8GgAIPU7xHCsUhB1PUgR//8GoI0bUdMRUKd69jw2UcKy7pGuu0NbJsOGqdSpdpvhO4LY/dgqohPEkE1TrBwKQ==", "requires": { "vue": "^2.1.10" + }, + "dependencies": { + "vue": { + "version": "2.6.14", + "resolved": "https://registry.npmjs.org/vue/-/vue-2.6.14.tgz", + "integrity": "sha512-x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ==" + } } }, "svgo": { @@ -19724,6 +19731,13 @@ "babel-preset-env": "^1.6.0", "rollup-plugin-babel": "^3.0.2", "vue": "^2.4.4" + }, + "dependencies": { + "vue": { + "version": "2.6.14", + "resolved": "https://registry.npmjs.org/vue/-/vue-2.6.14.tgz", + "integrity": "sha512-x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ==" + } } }, "vuejs-logger": { diff --git a/client/src/components/instruments/FilterGroup.vue b/client/src/components/instruments/FilterGroup.vue new file mode 100644 index 00000000..e9313a58 --- /dev/null +++ b/client/src/components/instruments/FilterGroup.vue @@ -0,0 +1,25 @@ + + + + + diff --git a/client/src/components/instruments/InstrumentFilter.vue b/client/src/components/instruments/InstrumentFilter.vue index 82f8e082..9591c40c 100644 --- a/client/src/components/instruments/InstrumentFilter.vue +++ b/client/src/components/instruments/InstrumentFilter.vue @@ -1,24 +1,33 @@