From 790f6de9f265e946c315d7954a81b5f37841787d Mon Sep 17 00:00:00 2001 From: T_S_V Date: Sun, 29 Mar 2020 12:18:33 +0300 Subject: [PATCH] Work for #12 - Vendor file big and take long time to load --- index.html | 4 +- package.json | 7 +- src/App.vue | 244 +++++++-------------------- src/components/SurveyCreator.vue | 4 +- src/{ => components}/customwidget.js | 0 src/views/Creator.vue | 159 +++++++++++++++++ src/views/ExportToPDF.vue | 196 +++++++++++++++++++++ src/views/Home.vue | 29 ++++ src/views/Survey.vue | 184 ++++++++++++++++++++ test/unit/specs/Hello.spec.js | 11 -- test/unit/specs/Home.spec.js | 12 ++ 11 files changed, 654 insertions(+), 196 deletions(-) rename src/{ => components}/customwidget.js (100%) create mode 100644 src/views/Creator.vue create mode 100644 src/views/ExportToPDF.vue create mode 100644 src/views/Home.vue create mode 100644 src/views/Survey.vue delete mode 100644 test/unit/specs/Hello.spec.js create mode 100644 test/unit/specs/Home.spec.js diff --git a/index.html b/index.html index 5fa6963b..05f976cd 100644 --- a/index.html +++ b/index.html @@ -1,8 +1,8 @@ - + - surveyjs_vue_quickstart + SurveyJS + VueJS
- - -

Survey Library:

- - -

Survey PDF:

- - -

Survey Creator:

- + +
diff --git a/src/components/SurveyCreator.vue b/src/components/SurveyCreator.vue index 59dbafda..c3787aa2 100644 --- a/src/components/SurveyCreator.vue +++ b/src/components/SurveyCreator.vue @@ -8,7 +8,7 @@ import "survey-creator/survey-creator.css"; import * as SurveyKo from "survey-knockout"; import * as widgets from "surveyjs-widgets"; -import { init as customWidget } from "../customwidget"; +import { init as customWidget } from "../components/customwidget"; import "inputmask/dist/inputmask/phone-codes/phone.js"; @@ -26,6 +26,8 @@ widgets.autocomplete(SurveyKo); widgets.bootstrapslider(SurveyKo); customWidget(SurveyKo); +SurveyKo.Serializer.addProperty("question", "tag:number"); + var CkEditor_ModalEditor = { afterRender: function(modalEditor, htmlElement) { var editor = window["CKEDITOR"].replace(htmlElement); diff --git a/src/customwidget.js b/src/components/customwidget.js similarity index 100% rename from src/customwidget.js rename to src/components/customwidget.js diff --git a/src/views/Creator.vue b/src/views/Creator.vue new file mode 100644 index 00000000..fa8a859a --- /dev/null +++ b/src/views/Creator.vue @@ -0,0 +1,159 @@ + + + + + diff --git a/src/views/ExportToPDF.vue b/src/views/ExportToPDF.vue new file mode 100644 index 00000000..daea502a --- /dev/null +++ b/src/views/ExportToPDF.vue @@ -0,0 +1,196 @@ + + + + + diff --git a/src/views/Home.vue b/src/views/Home.vue new file mode 100644 index 00000000..8e1ebd92 --- /dev/null +++ b/src/views/Home.vue @@ -0,0 +1,29 @@ + + + + + diff --git a/src/views/Survey.vue b/src/views/Survey.vue new file mode 100644 index 00000000..d90868fd --- /dev/null +++ b/src/views/Survey.vue @@ -0,0 +1,184 @@ + + + + + diff --git a/test/unit/specs/Hello.spec.js b/test/unit/specs/Hello.spec.js deleted file mode 100644 index 80140baa..00000000 --- a/test/unit/specs/Hello.spec.js +++ /dev/null @@ -1,11 +0,0 @@ -import Vue from 'vue' -import Hello from '@/components/Hello' - -describe('Hello.vue', () => { - it('should render correct contents', () => { - const Constructor = Vue.extend(Hello) - const vm = new Constructor().$mount() - expect(vm.$el.querySelector('.hello h1').textContent) - .to.equal('Welcome to Your Vue.js App') - }) -}) diff --git a/test/unit/specs/Home.spec.js b/test/unit/specs/Home.spec.js new file mode 100644 index 00000000..54159551 --- /dev/null +++ b/test/unit/specs/Home.spec.js @@ -0,0 +1,12 @@ +import Vue from "vue"; +import Hello from "@/views/Home"; + +describe("Home.vue", () => { + it("should render correct contents", () => { + const Constructor = Vue.extend(Hello); + const vm = new Constructor().$mount(); + expect(vm.$el.querySelector("h1").textContent).to.equal( + "SurveyJS + VueJS bolierplate" + ); + }); +});