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 @@ + + + + +