From 1d7c6a29d8e4e41dcdd7d5020ddbb6491712fecd Mon Sep 17 00:00:00 2001 From: bmauger Date: Thu, 2 Dec 2021 12:43:54 -0500 Subject: [PATCH 1/6] Initial push. --- src/layouts/component-test/component-test.vue | 73 ++++++++++++++- .../radio-horizontal/radio-horizontal.spec.js | 47 ++++++++++ .../radio-horizontal/radio-horizontal.vue | 90 +++++++++++++++++++ 3 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 src/ux-components/radio-horizontal/radio-horizontal.spec.js create mode 100644 src/ux-components/radio-horizontal/radio-horizontal.vue diff --git a/src/layouts/component-test/component-test.vue b/src/layouts/component-test/component-test.vue index ff80496fc..0d518eeee 100644 --- a/src/layouts/component-test/component-test.vue +++ b/src/layouts/component-test/component-test.vue @@ -185,6 +185,75 @@ /> +
+ +
+ +

Select Vehicle Year

+ + + +
+
+
+
+

Radio Horizontal

+
+
+
+ +
+ +

Select Vehicle Year

+ + +
+

Text Link

@@ -329,6 +398,7 @@ import radio from "@/ux-components/radio/radio"; import alert from "@/ux-components/alert/alert"; import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner"; + import radioHorizontal from "@/ux-components/radio-horizontal/radio-horizontal"; export default { name: "App", components: { @@ -338,7 +408,8 @@ listButton, radio, alert, - vehicleBanner + vehicleBanner, + radioHorizontal }, data() { return { diff --git a/src/ux-components/radio-horizontal/radio-horizontal.spec.js b/src/ux-components/radio-horizontal/radio-horizontal.spec.js new file mode 100644 index 000000000..d98130c33 --- /dev/null +++ b/src/ux-components/radio-horizontal/radio-horizontal.spec.js @@ -0,0 +1,47 @@ +import { shallowMount } from "@vue/test-utils"; +import radio from "./radio"; + +describe("radio.vue", () => { + it("Should render the 'radioID' prop value as the label and id value as well as the radio button value, groupName as the name value, and fire a click even that sets the display data attribute to true.", async () => { + // Act + const wrapper = shallowMount(radio, { + propsData: { + radioID: "2023", + groupName: "TestGroup", + loaderColor: "blue", + loaderPosition: "right", + sizeInRem: "1.5", + errorMessage: 'null' + }, + }); + + // Assert + const input = wrapper.find("input"); + const label = wrapper.find("label"); + const paragraph = wrapper.find("span"); + + await label.trigger('click'); + + expect(input.attributes()).toEqual({ + id: "2023", + type: "radio", + value: "2023", + name: "TestGroup", + }); + + expect(label.attributes()).toEqual({ + role: "radio", + tabindex: "0", + for: "2023", + class: "d-flex flex-column justify-content-center py-3 px-4", + "aria-checked": "false" + }); + + expect(label.text()).toEqual('2023'); + + expect(paragraph.text()).toEqual('2023'); + + expect(wrapper.vm.display).toBe(true); + + }); +}); diff --git a/src/ux-components/radio-horizontal/radio-horizontal.vue b/src/ux-components/radio-horizontal/radio-horizontal.vue new file mode 100644 index 000000000..6f81fa043 --- /dev/null +++ b/src/ux-components/radio-horizontal/radio-horizontal.vue @@ -0,0 +1,90 @@ + + + + + From 78bd99af5692eba2eca3be05aac83d2a5ba2bd79 Mon Sep 17 00:00:00 2001 From: bmauger Date: Thu, 2 Dec 2021 16:19:40 -0500 Subject: [PATCH 2/6] WIP CSR-186 horizontal radio button updates. --- src/layouts/component-test/component-test.vue | 16 ++ .../radio-horizontal/radio-horizontal.vue | 139 ++++++++++-------- 2 files changed, 94 insertions(+), 61 deletions(-) diff --git a/src/layouts/component-test/component-test.vue b/src/layouts/component-test/component-test.vue index 0d518eeee..ec3101752 100644 --- a/src/layouts/component-test/component-test.vue +++ b/src/layouts/component-test/component-test.vue @@ -241,6 +241,8 @@ loaderColor="blue" loaderPosition="right" sizeInRem="1" + v-bind:totalInGroup="3" + v-bind:positionInGroup="1" /> +
diff --git a/src/ux-components/radio-horizontal/radio-horizontal.vue b/src/ux-components/radio-horizontal/radio-horizontal.vue index 6f81fa043..d8c32ec9f 100644 --- a/src/ux-components/radio-horizontal/radio-horizontal.vue +++ b/src/ux-components/radio-horizontal/radio-horizontal.vue @@ -1,29 +1,31 @@ - - From 53019ccfa1c263b9ae92975f212cecc002cfb19f Mon Sep 17 00:00:00 2001 From: bmauger Date: Fri, 3 Dec 2021 07:45:31 -0500 Subject: [PATCH 3/6] Remove horizontal scrollbar from .container and .container-fluid. --- src/styles/common-styles.scss | 43 +++++++++++-------- .../radio-horizontal/radio-horizontal.vue | 1 - 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/styles/common-styles.scss b/src/styles/common-styles.scss index ab36e35c5..f01ffbefa 100644 --- a/src/styles/common-styles.scss +++ b/src/styles/common-styles.scss @@ -1,24 +1,29 @@ // Common/Global Styles // Use this file for global styles that don't or won't have their own stylesheet body { - font-size: 16px; - background-color: #fff; - padding: .5rem; - .container-fluid { - max-width: 576px;//Remove once desktop app is complete - &.container-shadow { - box-shadow: 0px 0px 6px 0px rgba(0,0,0,0.15);//Use instead of Bootstrap's helper - } - } - a { - color: $blue; - text-decoration: none; - border-bottom: 1px solid $blue; - &:hover { - color: $blue-400; - } - } - .pointer { - cursor: pointer; + font-size: 16px; + background-color: #fff; + padding: .5rem; + .container-fluid { + max-width: 576px;//Remove once desktop app is complete + &.container-shadow { + box-shadow: 0px 0px 6px 0px rgba(0,0,0,0.15);//Use instead of Bootstrap's helper } } + a { + color: $blue; + text-decoration: none; + border-bottom: 1px solid $blue; + &:hover { + color: $blue-400; + } + } + .pointer { + cursor: pointer; + } + .container, + .container-fluid { + overflow-x: hidden; + } +} +// Hide horizontal scrollbar diff --git a/src/ux-components/radio-horizontal/radio-horizontal.vue b/src/ux-components/radio-horizontal/radio-horizontal.vue index d8c32ec9f..73d8a72d0 100644 --- a/src/ux-components/radio-horizontal/radio-horizontal.vue +++ b/src/ux-components/radio-horizontal/radio-horizontal.vue @@ -48,7 +48,6 @@ export default { } else if(this.positionInGroup == 1) { className = 'first-item' } - console.log(typeof this.positionInGroup); return className; } } From 412999fcea2c6cfd4a2477e88ecd43844c44b605 Mon Sep 17 00:00:00 2001 From: bmauger Date: Fri, 3 Dec 2021 08:54:55 -0500 Subject: [PATCH 4/6] Remove duplicate. --- src/layouts/component-test/component-test.vue | 48 ++++--------------- 1 file changed, 8 insertions(+), 40 deletions(-) diff --git a/src/layouts/component-test/component-test.vue b/src/layouts/component-test/component-test.vue index ec3101752..d48df3e8f 100644 --- a/src/layouts/component-test/component-test.vue +++ b/src/layouts/component-test/component-test.vue @@ -69,7 +69,7 @@
-

Radio Button Group - Single-Line

+

Radio - Single-Line

@@ -108,7 +108,7 @@
-

Radio Button Group - Multi-Line

+

Radio - Multi-Line

@@ -148,50 +148,18 @@ />
-
- -
- -

Select Vehicle Year

- - - +
+
+

Radio - Multi-Line Centered

-
+
-

Select Vehicle Year

+

Multi-Line Centered

Date: Fri, 3 Dec 2021 09:05:50 -0500 Subject: [PATCH 5/6] WIP update unit test to correct failure. --- .../radio-horizontal/radio-horizontal.spec.js | 8 ++++---- src/ux-components/radio-horizontal/radio-horizontal.vue | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ux-components/radio-horizontal/radio-horizontal.spec.js b/src/ux-components/radio-horizontal/radio-horizontal.spec.js index d98130c33..ec12ce7ea 100644 --- a/src/ux-components/radio-horizontal/radio-horizontal.spec.js +++ b/src/ux-components/radio-horizontal/radio-horizontal.spec.js @@ -1,10 +1,10 @@ import { shallowMount } from "@vue/test-utils"; -import radio from "./radio"; +import radioHorizontal from "./radio-horizontal"; describe("radio.vue", () => { it("Should render the 'radioID' prop value as the label and id value as well as the radio button value, groupName as the name value, and fire a click even that sets the display data attribute to true.", async () => { // Act - const wrapper = shallowMount(radio, { + const wrapper = shallowMount(radioHorizontal, { propsData: { radioID: "2023", groupName: "TestGroup", @@ -31,9 +31,9 @@ describe("radio.vue", () => { expect(label.attributes()).toEqual({ role: "radio", - tabindex: "0", + tabindex: "-1", for: "2023", - class: "d-flex flex-column justify-content-center py-3 px-4", + class: "d-flex flex-column justify-content-center py-3 px-4 last-item", "aria-checked": "false" }); diff --git a/src/ux-components/radio-horizontal/radio-horizontal.vue b/src/ux-components/radio-horizontal/radio-horizontal.vue index 73d8a72d0..41fea15b3 100644 --- a/src/ux-components/radio-horizontal/radio-horizontal.vue +++ b/src/ux-components/radio-horizontal/radio-horizontal.vue @@ -1,7 +1,7 @@