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.spec.js b/src/common-components/button-question/button-question.spec.js
index d5608cd62..464fcf245 100644
--- a/src/common-components/button-question/button-question.spec.js
+++ b/src/common-components/button-question/button-question.spec.js
@@ -3,12 +3,14 @@ import buttonQuestion from "@/common-components/button-question/button-question"
import { nextTick } from "vue";
describe("buttonQuestion.vue", () => {
- it("Should show overflow classes on fieldset if isOverflowScrollable is true", async () => {
+ it("Should show overflow classes on fieldset if isOverflowScrollable is true", () => {
// Act
- const wrapper = shallowMount(buttonQuestion);
- await wrapper.setProps({
- isOverflowScrollable: true,
+ const wrapper = shallowMount(buttonQuestion, {
+ propsData: {
+ isOverflowScrollable: true,
+ }
});
+
// Assert
const fieldSet = wrapper.find('fieldset');
expect(fieldSet.classes()).toContain("overflow-scroll");
@@ -16,11 +18,12 @@ describe("buttonQuestion.vue", () => {
});
describe("buttonQuestion.vue", () => {
- it("Fieldset classes should contain row if button type is listCard", async () => {
+ it("Fieldset classes should contain row if button type is listCard", () => {
// Act
- const wrapper = shallowMount(buttonQuestion);
- await wrapper.setProps({
- buttonType: "listCard",
+ const wrapper = shallowMount(buttonQuestion, {
+ propsData: {
+ buttonType: "listCard",
+ }
});
// Assert
const Div = wrapper.find('fieldset div');
@@ -29,11 +32,12 @@ describe("buttonQuestion.vue", () => {
});
describe("buttonQuestion.vue", () => {
- it("Fieldset classes should contain d-flex if button type is listButtonHorizontal", async () => {
+ it("Fieldset classes should contain d-flex if button type is listButtonHorizontal", () => {
// Act
- const wrapper = shallowMount(buttonQuestion);
- await wrapper.setProps({
- buttonType: "listButtonHorizontal",
+ const wrapper = shallowMount(buttonQuestion, {
+ propsData: {
+ buttonType: "listButtonHorizontal",
+ }
});
// Assert
const Div = wrapper.find('fieldset div');
@@ -57,12 +61,13 @@ describe("buttonQuestion.vue", () => {
});
describe("buttonQuestion.vue", () => {
- it("Should add values to array on checkbox click", async () => {
+ it("Should add values to array on checkbox click", () => {
// Act
- const wrapper = shallowMount(buttonQuestion);
- await wrapper.setProps({
- modelValue: ["2022", "2021", "2020"],
- isMultiSelect: true
+ const wrapper = shallowMount(buttonQuestion, {
+ propsData: {
+ modelValue: ["2022", "2021", "2020"],
+ isMultiSelect: true,
+ }
});
const val = {isChecked: true, buttonId: "2019", }
wrapper.vm.handleCheckedChanged(val);
diff --git a/src/common-components/button-question/button-question.vue b/src/common-components/button-question/button-question.vue
index 0799446d5..823ce79fd 100644
--- a/src/common-components/button-question/button-question.vue
+++ b/src/common-components/button-question/button-question.vue
@@ -19,7 +19,7 @@
:textPosition="textPosition"
:isMultiSelect="isMultiSelect"
:groupName="groupName"
- :loaderEnabled="loaderEnabled"
+ :selectingInitiatesLoad="selectingInitiatesLoad"
:loaderColor="loaderColor"
:loaderPosition="loaderPosition"
:sizeInRem="sizeInRem"
@@ -29,13 +29,17 @@
:buttonImageId="answer.ImageId"
:altText="answer.Name ? answer.Name : answer"
screenReaderOnlyText="(opens new window)"
- :colLength="this.answers.length < 3 ? '' : '-4'"
+ :colLength="getColLength"
:selectedButtonIDs="selectedValues"
data-test="button"
+ :validationRules="validationRules"
/>
+
+
+
@@ -43,6 +47,7 @@
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 {
@@ -60,7 +65,7 @@ export default {
type: String,
default: "text-center",
},
- loaderEnabled: Boolean,
+ selectingInitiatesLoad: Boolean,
loaderColor: {
type: String,
default: "blue",
@@ -77,6 +82,8 @@ export default {
isOverflowScrollable: Boolean,
isWide: Boolean,
modelValue: Array,
+ validationRules: String,
+ suppressError: Boolean,
},
computed: {
getFieldSetClasses() {
@@ -102,6 +109,13 @@ export default {
}
return classes;
},
+ getColLength(){
+ if(this.isWide) {
+ return "12"
+ } else {
+ return this.answers.length < 3 ? '' : '-4';
+ }
+ },
selectedValues: {
get: function() {
return this.modelValue;
@@ -111,13 +125,6 @@ export default {
}
},
},
- mounted(){
- if(Array.isArray(this.answers) && this.answers.length === 1) {
- const newSelectedValues = this.selectedValues;
- newSelectedValues.push(typeof(this.answers[0]) === 'object' ? this.answers[0].Name : this.answers[0]);
- this.selectedValues = newSelectedValues;
- }
- },
methods: {
handleCheckedChanged(val) {
if(this.isMultiSelect) {
@@ -126,7 +133,7 @@ export default {
val.isChecked ? newSelectedValues.push(val.buttonId) : newSelectedValues.splice(newSelectedValues.indexOf(val.buttonId), 1);
this.selectedValues = newSelectedValues;
} else {
- this.selectedValues = [val.buttonId]
+ this.selectedValues = [val.buttonId];
}
},
},
@@ -134,6 +141,7 @@ 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 1c173b6be..6b2bd8335 100644
--- a/src/common-components/funnel-footer/funnel-footer.spec.js
+++ b/src/common-components/funnel-footer/funnel-footer.spec.js
@@ -5,7 +5,6 @@ describe("funnel-footer.vue", () => {
it("Should return footer-link class", async () => {
// Act
-
const r = {
test:"testing",
clientHeight: 10,
@@ -18,43 +17,38 @@ describe("funnel-footer.vue", () => {
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");
});
- 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");
+ 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 e61943761..cd9ad0975 100644
--- a/src/common-components/funnel-footer/funnel-footer.vue
+++ b/src/common-components/funnel-footer/funnel-footer.vue
@@ -17,7 +17,16 @@
-
+
diff --git a/src/common-components/funnel-sub-header/funnel-sub-header.vue b/src/common-components/funnel-sub-header/funnel-sub-header.vue
index 937109111..bc290d473 100644
--- a/src/common-components/funnel-sub-header/funnel-sub-header.vue
+++ b/src/common-components/funnel-sub-header/funnel-sub-header.vue
@@ -57,7 +57,7 @@ export default {
};
-
diff --git a/src/layouts/vehicle-damage/damage-location-question/damage-location-question.spec.js b/src/layouts/vehicle-damage/damage-location-question/damage-location-question.spec.js
index 65434b289..01f063eef 100644
--- a/src/layouts/vehicle-damage/damage-location-question/damage-location-question.spec.js
+++ b/src/layouts/vehicle-damage/damage-location-question/damage-location-question.spec.js
@@ -41,7 +41,7 @@ describe("damage-location-question.vue", () => {
damageLocationQuestion.methods.initializeComponent.call(wrapper.vm, cmsContent, damageOptions, "car-group");
//Assert
- expect(wrapper.vm.answersToDisplay).toStrictEqual([ { Name: 'car-Windshield' }, { Name: 'car-SideDoor' }, {Name: "car-RearWindow"} ])
+ expect(wrapper.vm.answersToDisplay).toStrictEqual([ { Name: 'car-Windshield' }, { Name: 'car-SideDoor' } ])
});
});
diff --git a/src/layouts/vehicle-damage/damage-location-question/damage-location-question.vue b/src/layouts/vehicle-damage/damage-location-question/damage-location-question.vue
index c48912ff2..58a74a31c 100644
--- a/src/layouts/vehicle-damage/damage-location-question/damage-location-question.vue
+++ b/src/layouts/vehicle-damage/damage-location-question/damage-location-question.vue
@@ -1,20 +1,30 @@
-
+
+
\ No newline at end of file
diff --git a/src/layouts/vehicle-damage/replace-options-question/replace-options-question.spec.js b/src/layouts/vehicle-damage/replace-options-question/replace-options-question.spec.js
index 103aecd4c..df8a16f90 100644
--- a/src/layouts/vehicle-damage/replace-options-question/replace-options-question.spec.js
+++ b/src/layouts/vehicle-damage/replace-options-question/replace-options-question.spec.js
@@ -24,7 +24,7 @@ describe("replace-options-question.vue", () => {
test("Answers to display filtered by data from api.", async () => {
//Arrange
- const { wrapper, cmsContent, replaceOptions } = setupMocks({ dataFromStoreApi: ["Windshield", "FrontDoor"]});
+ const { wrapper, cmsContent, replaceOptions } = setupMocks({ dataFromStoreApi: ["Windshield", "FrontDoor"], filterByVehicleCategory: true});
//Act
replaceOptionsQuestion.methods.initializeComponent.call(wrapper.vm, cmsContent, replaceOptions, "car-group");
diff --git a/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue b/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue
index 41ecac799..f47abea5d 100644
--- a/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue
+++ b/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue
@@ -1,14 +1,16 @@
-
+
@@ -17,6 +19,15 @@
\ No newline at end of file
diff --git a/src/layouts/vehicle-damage/windshield-options/windshield-options.vue b/src/layouts/vehicle-damage/windshield-options/windshield-options.vue
new file mode 100644
index 000000000..68cce08eb
--- /dev/null
+++ b/src/layouts/vehicle-damage/windshield-options/windshield-options.vue
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/layouts/vehicle-make/make-question/make-question.vue b/src/layouts/vehicle-make/make-question/make-question.vue
index 9fb2d6ea1..bc8ce5f9f 100644
--- a/src/layouts/vehicle-make/make-question/make-question.vue
+++ b/src/layouts/vehicle-make/make-question/make-question.vue
@@ -2,11 +2,11 @@
diff --git a/src/layouts/vehicle-model/model-question/model-question.vue b/src/layouts/vehicle-model/model-question/model-question.vue
index e79b8bafc..1876630ef 100644
--- a/src/layouts/vehicle-model/model-question/model-question.vue
+++ b/src/layouts/vehicle-model/model-question/model-question.vue
@@ -2,11 +2,11 @@
diff --git a/src/layouts/vehicle-style/style-question/style-question.vue b/src/layouts/vehicle-style/style-question/style-question.vue
index bfec78571..a923c9128 100644
--- a/src/layouts/vehicle-style/style-question/style-question.vue
+++ b/src/layouts/vehicle-style/style-question/style-question.vue
@@ -2,11 +2,11 @@
diff --git a/src/layouts/vehicle-year/year-question/year-question.vue b/src/layouts/vehicle-year/year-question/year-question.vue
index 96d047244..97c2ab618 100644
--- a/src/layouts/vehicle-year/year-question/year-question.vue
+++ b/src/layouts/vehicle-year/year-question/year-question.vue
@@ -2,11 +2,11 @@
diff --git a/src/styles/common-error-styles.scss b/src/styles/common-error-styles.scss
index c2c6c3fea..d7d1c019d 100644
--- a/src/styles/common-error-styles.scss
+++ b/src/styles/common-error-styles.scss
@@ -1,10 +1,56 @@
.has-error {
- .list-button,
- .list-card,
- .list-button-horizontal {
+ &.list-button,
+ &.list-card {
+ border: 1px solid transparent;
+ color: $red;
+ label {
+ border: 1px solid $red;
+ border-radius: .5rem;
+ }
+ }
+ input[type=checkbox]:focus + label,
+ input[type=radio]:focus + label,
+ input[type=checkbox]:checked + label,
+ input[type=radio]:checked + label {
+ box-shadow: 0 0 0 2.5px transparent !important;
+ }
+ &.list-button-horizontal {
color: $red;
label {
border: 1px solid $red;
}
}
+ &.ui-radio,
+ &.ui-checkbox {
+ input[type=radio]+label:before,
+ input[type=checkbox]+label:before {
+ border: 1px solid $red;
+ }
+ input[type=checkbox]:checked + label:before {
+ border: 1px solid $blue;
+ }
+ }
+}
+
+.form-test-error {
+ color: $red;
+ font-size: .875rem;
+ font-weight: 500;
+}
+
+.form-test-invalid {
+ &.btn.btn-primary {
+ color: $gray;
+ background: $gray-200;
+ cursor: pointer;
+ pointer-events: all;
+ }
+ &.btn.btn-primary:hover,
+ &.btn.btn-primary:focus,
+ &.btn.btn-primary:focus-visible {
+ color: $gray;
+ background: $gray-200;
+ box-shadow: none;
+ }
+
}
diff --git a/src/ux-components/button-main/button-main.vue b/src/ux-components/button-main/button-main.vue
index 2a4a68366..2621d6bcd 100644
--- a/src/ux-components/button-main/button-main.vue
+++ b/src/ux-components/button-main/button-main.vue
@@ -1,5 +1,10 @@
-