From 549a8b359319b32217ab348ce226e04f39f1596f Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Fri, 7 Jan 2022 16:00:34 -0500 Subject: [PATCH 01/21] CSR-254: create form-test page and begin testing validation --- package.json | 1 + src/layouts/form-test/form-test.vue | 162 ++++++++++++++++++ src/router/index.js | 6 + .../list-button-horizontal.vue | 60 ++++++- src/ux-components/list-card/list-card.vue | 104 +++++++++-- 5 files changed, 317 insertions(+), 16 deletions(-) create mode 100644 src/layouts/form-test/form-test.vue diff --git a/package.json b/package.json index 58b8837dd..50a9b5760 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.5", "http-status-codes": "^2.1.4", "jest-junit": "^13.0.0", + "vee-validate": "^4.5.7", "vue": "^3.0.0", "vue-router": "^4.0.11", "vuex": "^4.0.2", diff --git a/src/layouts/form-test/form-test.vue b/src/layouts/form-test/form-test.vue new file mode 100644 index 000000000..96bc9bd33 --- /dev/null +++ b/src/layouts/form-test/form-test.vue @@ -0,0 +1,162 @@ + + + diff --git a/src/router/index.js b/src/router/index.js index c135d60c1..2f4f0daad 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -3,6 +3,7 @@ import { storeActions } from "@/constants/store-actions.js"; import { lazyLoadComponent } from "@/router/dynamic-routing/component-loader.js"; import { routingTable } from "@/router/router-constants/routing-table.js"; import ComponentTest from "@/layouts/component-test/component-test.vue"; +import FormTest from "@/layouts/form-test/form-test.vue"; import NotFound from "@/layouts/not-found/not-found.vue"; import store from "@/store"; @@ -17,6 +18,11 @@ const routes = [ name: "ComponentTest", component: ComponentTest, }, + { + path: "/form-test", // This is a temporary route for testing. + name: "FormTest", + component: FormTest, + }, { path: "/", beforeEnter(to, from, next) { diff --git a/src/ux-components/list-button-horizontal/list-button-horizontal.vue b/src/ux-components/list-button-horizontal/list-button-horizontal.vue index 97642d2c1..ef5632b5a 100644 --- a/src/ux-components/list-button-horizontal/list-button-horizontal.vue +++ b/src/ux-components/list-button-horizontal/list-button-horizontal.vue @@ -2,16 +2,46 @@ diff --git a/src/ux-components/list-card/list-card.vue b/src/ux-components/list-card/list-card.vue index 68b1c80b0..6d06651f4 100644 --- a/src/ux-components/list-card/list-card.vue +++ b/src/ux-components/list-card/list-card.vue @@ -1,24 +1,61 @@ From 42d2d6334bccf0ef18158aaf6e8ff547b1fbaa4b Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Mon, 10 Jan 2022 17:38:32 -0500 Subject: [PATCH 02/21] CSR-254: add generic textInput component and add validation on form-test --- .../text-input/text-input.spec.js | 38 ++++++++++ .../text-input/text-input.vue | 70 +++++++++++++++++++ src/layouts/form-test/form-test.vue | 46 +++++++++--- .../list-button-horizontal.vue | 2 +- 4 files changed, 147 insertions(+), 9 deletions(-) create mode 100644 src/common-components/text-input/text-input.spec.js create mode 100644 src/common-components/text-input/text-input.vue diff --git a/src/common-components/text-input/text-input.spec.js b/src/common-components/text-input/text-input.spec.js new file mode 100644 index 000000000..fcb08d57a --- /dev/null +++ b/src/common-components/text-input/text-input.spec.js @@ -0,0 +1,38 @@ +import { shallowMount } from "@vue/test-utils"; +import textInput from "./text-input"; + +describe("text-input.vue", () => { + + it("Should render a text input", async () => { + // Act + const wrapper = shallowMount(textInput, { + propsData: { + name: "test", + label: "unit test label", + }, + }); + + // Assert + const input = wrapper.find("input"); + + expect(input.exists()).toBe(true); + }); + + it("Should return aria-required state", async () => { + // Act + const wrapper = shallowMount(textInput, { + propsData: { + name: "test", + label: "unit test label", + isRequired: true + }, + }); + + // Assert + const input = wrapper.find("input"); + + expect(input.attributes()["aria-required"]).toEqual("true"); + + }); + +}); \ No newline at end of file diff --git a/src/common-components/text-input/text-input.vue b/src/common-components/text-input/text-input.vue new file mode 100644 index 000000000..50096a52f --- /dev/null +++ b/src/common-components/text-input/text-input.vue @@ -0,0 +1,70 @@ + + + + diff --git a/src/layouts/form-test/form-test.vue b/src/layouts/form-test/form-test.vue index 96bc9bd33..4d0ef09bd 100644 --- a/src/layouts/form-test/form-test.vue +++ b/src/layouts/form-test/form-test.vue @@ -1,8 +1,8 @@