diff --git a/src/ux-components/radio/radio.spec.js b/src/ux-components/radio/radio.spec.js index a7c3318ed..113d534c6 100644 --- a/src/ux-components/radio/radio.spec.js +++ b/src/ux-components/radio/radio.spec.js @@ -60,4 +60,42 @@ describe("radio.vue", () => { expect(paragraph.text()).toEqual("screenreader text"); }); + + it("Should emit button value on click", async () => { + // Act + const wrapper = shallowMount(radio, { + propsData: { + buttonLabel: "Windshield", + value: "List Card Checkbox", + buttonID: "List Card Checkbox", + groupID: "radio-demo-1", + groupName: "radio 1", + isRequired: true, + isWide: false, + modelValue: ["List Card Checkbox"], + }, + }); + wrapper.vm.handleCheckChange(); + // Assert + expect(wrapper.emitted()["isCheckedChanged"][0]).toEqual([{"buttonID": "List Card Checkbox", value: "List Card Checkbox", checkValue: Boolean}]); + }); + + it("Should set checkValue data if selectedButtonIDs has value(s)", async () => { + // Act + const wrapper = shallowMount(radio, { + propsData: { + buttonLabel: "Windshield", + buttonID: "List Card Checkbox", + groupID: "radio-demo-1", + groupName: "radio 1", + buttonImage: "windshield-damage.svg", + isRequired: true, + modelValue: ["List Card Checkbox"], + value: "Car-Front", + selectedValues: ["Car-Front"] + }, + }); + // Assert + expect(wrapper.componentVM.checkValue).toEqual(true); + }); }); diff --git a/src/ux-components/radio/radio.vue b/src/ux-components/radio/radio.vue index 99629a39b..17fb7a880 100644 --- a/src/ux-components/radio/radio.vue +++ b/src/ux-components/radio/radio.vue @@ -10,7 +10,8 @@ :aria-required="isRequired" :value="value" :v-model="checkValue" - @change="handleCheckChanged()" + @change="handleCheckChange()" + :checked="checkValue" />