From 5f5367a6cfe207d2fb02a9568962fafbb9bb0152 Mon Sep 17 00:00:00 2001 From: i348307 Date: Thu, 9 Jan 2020 10:20:41 +0200 Subject: [PATCH 1/8] Align next button + cards + inputs + overall --- frontend/src/App.vue | 127 +++++++++++------- frontend/src/components/Header.vue | 2 +- frontend/src/components/Navigation.vue | 5 +- .../src/components/QuestionTypeSelector.vue | 99 +++++++++----- .../QuestionTypes/GeneratorSelection.vue | 1 + .../QuestionTypes/QuestionCheckbox.vue | 60 ++++----- .../QuestionTypes/QuestionConfirm.vue | 25 ++-- .../QuestionTypes/QuestionEditor.vue | 20 ++- .../QuestionTypes/QuestionExpand.vue | 31 ++--- .../QuestionTypes/QuestionInput.vue | 41 ++++-- .../components/QuestionTypes/QuestionList.vue | 68 ++++------ frontend/src/components/Step.vue | 8 +- frontend/src/main.js | 1 - frontend/src/plugins/vuetify.js | 7 +- .../QuestionTypes/QuestionCheckbox.spec.js | 9 +- .../QuestionTypes/QuestionExpand.spec.js | 3 +- .../QuestionTypes/QuestionInput.spec.js | 5 +- .../QuestionTypes/QuestionList.spec.js | 5 +- 18 files changed, 289 insertions(+), 228 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index f5a707e7..0d4ff9a6 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,23 +1,28 @@ + - + \ No newline at end of file diff --git a/frontend/src/components/QuestionTypes/GeneratorSelection.vue b/frontend/src/components/QuestionTypes/GeneratorSelection.vue index 234a1b75..35819ac9 100644 --- a/frontend/src/components/QuestionTypes/GeneratorSelection.vue +++ b/frontend/src/components/QuestionTypes/GeneratorSelection.vue @@ -104,6 +104,7 @@ export default { .card-deck { margin: 0rem; + height: 100%; } .card.generator { diff --git a/frontend/src/components/QuestionTypes/QuestionCheckbox.vue b/frontend/src/components/QuestionTypes/QuestionCheckbox.vue index dba43f17..8971b7cf 100644 --- a/frontend/src/components/QuestionTypes/QuestionCheckbox.vue +++ b/frontend/src/components/QuestionTypes/QuestionCheckbox.vue @@ -1,31 +1,33 @@ diff --git a/frontend/src/components/QuestionTypes/QuestionConfirm.vue b/frontend/src/components/QuestionTypes/QuestionConfirm.vue index 0f3bac6a..5cd2c7ad 100644 --- a/frontend/src/components/QuestionTypes/QuestionConfirm.vue +++ b/frontend/src/components/QuestionTypes/QuestionConfirm.vue @@ -1,9 +1,10 @@ @@ -13,19 +14,11 @@ export default { props: { currentQuestion: Object } -} +}; diff --git a/frontend/src/components/QuestionTypes/QuestionEditor.vue b/frontend/src/components/QuestionTypes/QuestionEditor.vue index 2f596def..7899c941 100644 --- a/frontend/src/components/QuestionTypes/QuestionEditor.vue +++ b/frontend/src/components/QuestionTypes/QuestionEditor.vue @@ -1,10 +1,14 @@ + \ No newline at end of file diff --git a/frontend/src/components/QuestionTypes/QuestionExpand.vue b/frontend/src/components/QuestionTypes/QuestionExpand.vue index 135114b7..53184f46 100644 --- a/frontend/src/components/QuestionTypes/QuestionExpand.vue +++ b/frontend/src/components/QuestionTypes/QuestionExpand.vue @@ -1,12 +1,15 @@ @@ -18,22 +21,20 @@ export default { }, methods: { onClick(answer) { - this.currentQuestion.answer = answer + this.currentQuestion.answer = answer; } } -} +}; diff --git a/frontend/src/components/QuestionTypes/QuestionInput.vue b/frontend/src/components/QuestionTypes/QuestionInput.vue index 4bc4f9cf..cc88eadc 100644 --- a/frontend/src/components/QuestionTypes/QuestionInput.vue +++ b/frontend/src/components/QuestionTypes/QuestionInput.vue @@ -1,15 +1,20 @@ + \ No newline at end of file diff --git a/frontend/src/components/QuestionTypes/QuestionList.vue b/frontend/src/components/QuestionTypes/QuestionList.vue index c0cf508d..ea0cf7d3 100644 --- a/frontend/src/components/QuestionTypes/QuestionList.vue +++ b/frontend/src/components/QuestionTypes/QuestionList.vue @@ -1,85 +1,71 @@ - diff --git a/frontend/src/components/Step.vue b/frontend/src/components/Step.vue index 8a7dddba..3854f6aa 100644 --- a/frontend/src/components/Step.vue +++ b/frontend/src/components/Step.vue @@ -1,13 +1,9 @@ diff --git a/frontend/src/main.js b/frontend/src/main.js index 1b2eeea7..6835a780 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -7,7 +7,6 @@ import 'bootstrap/dist/css/bootstrap.css'; import 'bootstrap-vue/dist/bootstrap-vue.css'; import vuetify from "./plugins/vuetify"; -import "material-design-icons-iconfont/dist/material-design-icons.css"; Vue.use(BootstrapVue); Vue.config.productionTip = false diff --git a/frontend/src/plugins/vuetify.js b/frontend/src/plugins/vuetify.js index 2f13eb0b..9ca37f2e 100644 --- a/frontend/src/plugins/vuetify.js +++ b/frontend/src/plugins/vuetify.js @@ -4,7 +4,8 @@ import "material-design-icons-iconfont/dist/material-design-icons.css"; import '@mdi/font/css/materialdesignicons.css' Vue.use(Vuetify, { - iconfont: 'mdi' -}) + iconfont: 'mdi' + }) + export default new Vuetify({ -}); \ No newline at end of file +}); diff --git a/frontend/tests/components/QuestionTypes/QuestionCheckbox.spec.js b/frontend/tests/components/QuestionTypes/QuestionCheckbox.spec.js index 30c05140..d31c5d13 100644 --- a/frontend/tests/components/QuestionTypes/QuestionCheckbox.spec.js +++ b/frontend/tests/components/QuestionTypes/QuestionCheckbox.spec.js @@ -1,6 +1,5 @@ import QuestionCheckbox from '../../../src/components/QuestionTypes/QuestionCheckbox.vue' import { initComponent, destroy } from '../../Utils' -import {BFormCheckboxGroup} from 'bootstrap-vue' let wrapper @@ -63,8 +62,8 @@ describe('QuestionCheckbox.vue', () => { } }) - const bFormCheckboxGroup = wrapper.find(BFormCheckboxGroup) - expect(bFormCheckboxGroup.vm.options[0].text).toBe('testName1') + const bFormCheckboxGroup = wrapper.find('v-checkbox-stub') + expect(bFormCheckboxGroup.vm.label).toBe('testName1') }) test('choices is not array', () => { @@ -74,8 +73,8 @@ describe('QuestionCheckbox.vue', () => { } }) - const bFormCheckboxGroup = wrapper.find(BFormCheckboxGroup) - expect(bFormCheckboxGroup.vm.options).toHaveLength(0) + const bFormCheckboxGroup = wrapper.find('v-checkbox-stub') + expect(bFormCheckboxGroup.vm).toBeUndefined() }) }) }) diff --git a/frontend/tests/components/QuestionTypes/QuestionExpand.spec.js b/frontend/tests/components/QuestionTypes/QuestionExpand.spec.js index b15dd923..976f442f 100644 --- a/frontend/tests/components/QuestionTypes/QuestionExpand.spec.js +++ b/frontend/tests/components/QuestionTypes/QuestionExpand.spec.js @@ -1,5 +1,4 @@ import QuestionExpand from '../../../src/components/QuestionTypes/QuestionExpand.vue' -import {BButton} from 'bootstrap-vue' import {initComponent, destroy} from '../../Utils' let wrapper @@ -19,7 +18,7 @@ describe('QuestionExpand.vue', () => { expect(wrapper.vm.currentQuestion.answer).toBeUndefined() - wrapper.find(BButton).trigger('click') + wrapper.find('button').trigger('click') await wrapper.vm.$nextTick() expect(wrapper.vm.currentQuestion.answer).toBe('testValue') diff --git a/frontend/tests/components/QuestionTypes/QuestionInput.spec.js b/frontend/tests/components/QuestionTypes/QuestionInput.spec.js index 18461242..50950d26 100644 --- a/frontend/tests/components/QuestionTypes/QuestionInput.spec.js +++ b/frontend/tests/components/QuestionTypes/QuestionInput.spec.js @@ -1,5 +1,4 @@ import QuestionInput from '../../../src/components/QuestionTypes/QuestionInput.vue' -import {BFormInput} from 'bootstrap-vue' import {initComponent, destroy} from '../../Utils' let wrapper @@ -18,7 +17,7 @@ describe('QuestionInput.vue', () => { } }) - const bFormInput = wrapper.find(BFormInput) + const bFormInput = wrapper.find('v-text-field-stub') expect(bFormInput.vm.type).toBe('time') }) @@ -29,7 +28,7 @@ describe('QuestionInput.vue', () => { } }) - const bFormInput = wrapper.find(BFormInput) + const bFormInput = wrapper.find('v-text-field-stub') expect(bFormInput.vm.type).toBe('text') }) }) diff --git a/frontend/tests/components/QuestionTypes/QuestionList.spec.js b/frontend/tests/components/QuestionTypes/QuestionList.spec.js index a3747d0c..bbedf6d0 100644 --- a/frontend/tests/components/QuestionTypes/QuestionList.spec.js +++ b/frontend/tests/components/QuestionTypes/QuestionList.spec.js @@ -1,5 +1,4 @@ import QuestionList from '../../../src/components/QuestionTypes/QuestionList.vue' -import {BFormSelect} from 'bootstrap-vue' import {initComponent, destroy} from '../../Utils' let wrapper @@ -115,7 +114,7 @@ describe('QuestionList.vue', () => { } }) - const options = wrapper.find(BFormSelect).vm.options + const options = wrapper.find('v-select-stub').vm.items expect(options).toHaveLength(0) }) @@ -131,7 +130,7 @@ describe('QuestionList.vue', () => { } }) - const options = wrapper.find(BFormSelect).vm.options + const options = wrapper.find('v-select-stub').vm.items expect(options).toHaveLength(4) expect(options[0].name).toBe('testName1') expect(options[0].text).toBe('testText1') From 8167ba1fa589cc6445c52fb17f1d946b893c68d5 Mon Sep 17 00:00:00 2001 From: i348307 Date: Thu, 9 Jan 2020 11:09:31 +0200 Subject: [PATCH 2/8] Support different checkbox data type --- frontend/src/components/QuestionTypes/QuestionCheckbox.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/QuestionTypes/QuestionCheckbox.vue b/frontend/src/components/QuestionTypes/QuestionCheckbox.vue index 8971b7cf..845eafed 100644 --- a/frontend/src/components/QuestionTypes/QuestionCheckbox.vue +++ b/frontend/src/components/QuestionTypes/QuestionCheckbox.vue @@ -2,7 +2,7 @@

{{currentQuestion.message}}

- +