diff --git a/jest.config.js b/jest.config.js index 8b510e95c..7a6fcbc01 100644 --- a/jest.config.js +++ b/jest.config.js @@ -12,6 +12,7 @@ module.exports = { "!src/router/**/*.js", "!src/helpers/unit-test-helper.js", "!src/layouts/component-test/component-test.vue", + "!src/layouts/form-test/form-test.vue", "!src/layouts/address-poc/address-poc.vue" ], //! means exclude from coverage. testMatch: ["**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"], diff --git a/package.json b/package.json index 6033a0009..ee8fdeb88 100644 --- a/package.json +++ b/package.json @@ -16,11 +16,13 @@ "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-plugin-load-script": "^2.1.0", "vue-router": "^4.0.11", "vuex": "^4.0.2", - "vuex-persistedstate": "^4.1.0" + "vuex-persistedstate": "^4.1.0", + "yup": "^0.32.11" }, "devDependencies": { "@vue/cli-plugin-babel": "~4.5.0", 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..e8d63f9e4 --- /dev/null +++ b/src/common-components/text-input/text-input.vue @@ -0,0 +1,71 @@ + + + + diff --git a/src/layouts/form-test/form-test.vue b/src/layouts/form-test/form-test.vue new file mode 100644 index 000000000..4d9db67f4 --- /dev/null +++ b/src/layouts/form-test/form-test.vue @@ -0,0 +1,338 @@ + + + + + \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index b1aa88493..7633f9d1a 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -3,9 +3,8 @@ 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 AddressPOC from "@/layouts/address-poc/address-poc.vue"; - import NotFound from "@/layouts/not-found/not-found.vue"; import store from "@/store"; @@ -20,6 +19,11 @@ const routes = [ name: "ComponentTest", component: ComponentTest, }, + { + path: "/form-test", // This is a temporary route for testing. + name: "FormTest", + component: FormTest, + }, { path: "/address-poc", // This is a temporary route for testing. name: "AddressPOC", 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 c4f8d995c..5be79c49c 100644 --- a/src/ux-components/list-button-horizontal/list-button-horizontal.vue +++ b/src/ux-components/list-button-horizontal/list-button-horizontal.vue @@ -1,16 +1,50 @@ @@ -72,8 +126,8 @@ export default { input[type="radio"], input[type="checkbox"] { opacity: 0; - position: fixed; width: 0; + height: 0; &:focus-visible + label { box-shadow: 0 0 0 2px $blue; } diff --git a/src/ux-components/list-button/list-button.vue b/src/ux-components/list-button/list-button.vue index d82486f23..7087ff23f 100644 --- a/src/ux-components/list-button/list-button.vue +++ b/src/ux-components/list-button/list-button.vue @@ -1,16 +1,42 @@ + + \ No newline at end of file diff --git a/src/ux-components/list-card/list-card.vue b/src/ux-components/list-card/list-card.vue index 1bd0739ba..450151a4d 100644 --- a/src/ux-components/list-card/list-card.vue +++ b/src/ux-components/list-card/list-card.vue @@ -1,24 +1,61 @@ @@ -77,8 +159,8 @@ export default { input[type='checkbox'], input[type="radio"] { opacity: 0; - position: fixed; width: 0; + height: 0; + label { display: block; position: relative;