diff --git a/jest.config.js b/jest.config.js
index 36c4507fc..b8beb88cc 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -13,6 +13,8 @@ module.exports = {
"!src/helpers/unit-test-helper.js",
"!src/layouts/component-test/component-test.vue",
"!src/layouts/form-test/form-test.vue",
+ "!src/layouts/vehicle-damage/windshield-damage-type-question/windshield-damage-type-question.vue",
+ "!src/layouts/vehicle-damage/windshield-options/windshield-options.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/src/common-components/button-question/button-question.vue b/src/common-components/button-question/button-question.vue
index 7fff5c238..417230464 100644
--- a/src/common-components/button-question/button-question.vue
+++ b/src/common-components/button-question/button-question.vue
@@ -7,9 +7,9 @@
+
+
+
@@ -43,6 +47,8 @@
import listButton from "@/ux-components/list-button/list-button";
import listButtonHorizontal from "@/ux-components/list-button-horizontal/list-button-horizontal";
import listCard from "@/ux-components/list-card/list-card";
+import { ErrorMessage } from 'vee-validate';
+import radio from "@/ux-components/radio/radio";
export default {
name: "buttonQuestion",
@@ -76,6 +82,10 @@ export default {
isOverflowScrollable: Boolean,
isWide: Boolean,
modelValue: Array,
+ validationRules: String,
+ name: String,
+ value: String,
+ suppressError: Boolean,
},
computed: {
getFieldSetClasses() {
@@ -95,6 +105,9 @@ export default {
case 'listCard':
classes = 'row justify-content-center g-2'
break;
+ case 'radio':
+ classes = 'ui-radio d-flex'
+ break;
}
return classes;
},
@@ -115,6 +128,9 @@ export default {
}
},
methods: {
+ chooseAnswer(answer) {
+ this.$emit("update:modelValue", answer);
+ },
handleCheckedChanged(val) {
if(this.isMultiSelect) {
// Add or remove item to array of data to emit
@@ -130,6 +146,8 @@ export default {
listButton,
listButtonHorizontal,
listCard,
+ ErrorMessage,
+ radio,
},
};
diff --git a/src/common-components/funnel-footer/funnel-footer.spec.js b/src/common-components/funnel-footer/funnel-footer.spec.js
index a4c127a3e..6b2bd8335 100644
--- a/src/common-components/funnel-footer/funnel-footer.spec.js
+++ b/src/common-components/funnel-footer/funnel-footer.spec.js
@@ -5,90 +5,50 @@ describe("funnel-footer.vue", () => {
it("Should return footer-link class", async () => {
// Act
-
const r = {
test:"testing",
clientHeight: 10,
- classList: {
- add: jest.fn(() => ''),
- remove: jest.fn()
- },
+ offsetHeight: 24,
};
- global.document.getElementById = jest.fn().mockImplementation(()=> {
+ global.document.querySelector = jest.fn().mockImplementation(()=> {
return r;
});
const wrapper = mount(funnelFooter, {
});
+ wrapper.vm.initializeComponent(cmsContent);
// Assert
const link = wrapper.find("a");
- console.log(wrapper.html());
// Expect
- expect(link.attributes('class')).toContain("footer-link");
- expect(global.document.getElementById).toBeCalled();
- expect(r.classList.add).toBeCalledWith("justify-content-end");
- expect(r.classList.remove).toBeCalledWith("justify-content-start");
+ expect(link.attributes('class')).toContain("footer");
});
- it("Should return link text", async () => {
+ it("Should emit ForwardClicked on button click", async () => {
// Act
const wrapper = mount(funnelFooter, {
- propsData: {
- text: "Terms of use",
- },
});
-
+ wrapper.vm.buttonClick();
// Assert
- const link = wrapper.find("a");
-
- expect(link.text()).toEqual("Terms of use");
+ expect(wrapper.emitted()["ForwardClicked"][0]).toHaveBeenCalled;
});
- it("Should return class btn-primary", async () => {
+ it("Should emit BackClicked on link click", async () => {
// Act
const wrapper = mount(funnelFooter, {
- propsData: {
- isPrimary: true,
- },
});
-
+ wrapper.vm.linkClick();
// Assert
- const input = wrapper.find("button");
-
- // Expect
- expect(input.attributes("class")).toContain("btn-primary");
- });
-
- it("Should return class justify-content-end if paddingHeight < 80px", async () => {
-
- global.document.getElementById = jest.fn().mockImplementation(()=> {
- return {
- test:"testing",
- clientHeight: 10,
- classList: {
- add: jest.fn(),
- remove: jest.fn()
- }
- }
- });
-
- // Act
- const wrapper = mount(funnelFooter, {
- propsData: {
- footer: true
- },
- });
- const infoBox = document.getElementById('infoBox');
- // Assert
- const stacked = wrapper.find("#stacked");
- wrapper.vm.paddingHeight = 100;
-
- // Expect
- expect(stacked.attributes('class')).toContain("justify-content-end");
+ expect(wrapper.emitted()["BackClicked"][0]).toHaveBeenCalled;
});
});
+
+//Mock CMS content
+const cmsContent = {
+ backLink: "text",
+ buttonText: "text",
+};
diff --git a/src/common-components/funnel-footer/funnel-footer.vue b/src/common-components/funnel-footer/funnel-footer.vue
index 37879d2cf..af604ed99 100644
--- a/src/common-components/funnel-footer/funnel-footer.vue
+++ b/src/common-components/funnel-footer/funnel-footer.vue
@@ -1,28 +1,44 @@
-
@@ -949,8 +959,8 @@ import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner";
import funnelHeader from "@/common-components/funnel-header/funnel-header";
import listButtonHorizontal from "@/ux-components/list-button-horizontal/list-button-horizontal";
import checkbox from "@/ux-components/checkbox/checkbox";
+import radio from "@/ux-components/radio/radio";
import textLink from "@/ux-components/text-link/text-link";
-import funnelFooter from "@/common-components/funnel-footer/funnel-footer";
export default {
name: "App",
components: {
@@ -962,9 +972,9 @@ export default {
vehicleBanner,
listButtonHorizontal,
checkbox,
+ radio,
funnelHeader,
- textLink,
- funnelFooter
+ textLink
},
data() {
return {
diff --git a/src/layouts/form-test/form-test.vue b/src/layouts/form-test/form-test.vue
index d56b764b3..1e6d0d7b2 100644
--- a/src/layouts/form-test/form-test.vue
+++ b/src/layouts/form-test/form-test.vue
@@ -1,367 +1,164 @@
-