diff --git a/src/layouts/component-test/component-test.vue b/src/layouts/component-test/component-test.vue index ff80496fc..45768db57 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,13 +148,18 @@ />
+
+
+

Radio - Multi-Line Centered

+
+
-
+
-

Select Vehicle Year

+

Multi-Line Centered

+
+
+

Radio Horizontal

+
+
+
+ +
+ +

Select Vehicle Year

+ + + +
+

Text Link

@@ -329,6 +382,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 +392,8 @@ listButton, radio, alert, - vehicleBanner + vehicleBanner, + radioHorizontal }, data() { return { 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.spec.js b/src/ux-components/radio-horizontal/radio-horizontal.spec.js new file mode 100644 index 000000000..ec12ce7ea --- /dev/null +++ b/src/ux-components/radio-horizontal/radio-horizontal.spec.js @@ -0,0 +1,47 @@ +import { shallowMount } from "@vue/test-utils"; +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(radioHorizontal, { + 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: "-1", + for: "2023", + class: "d-flex flex-column justify-content-center py-3 px-4 last-item", + "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..41fea15b3 --- /dev/null +++ b/src/ux-components/radio-horizontal/radio-horizontal.vue @@ -0,0 +1,106 @@ + + + +