Merge branch 'develop' into bugfix/CSR-459

This commit is contained in:
Adam Caouette 2022-04-11 17:03:59 -04:00
commit 4cee1b10c5
12 changed files with 52 additions and 63 deletions

View file

@ -9,8 +9,8 @@
class="position-absolute rounded-0 w-100 border-0 shadow-sm"
v-if="displayGlobalAlert"
:alertClass="globalAlertMessage.type"
:alertHeadline="globalAlertMessage.messageHeadline"
:alertCopy="globalAlertMessage.messageCopy"
:manualHeadline="globalAlertMessage.messageHeadline"
:manualCopy="globalAlertMessage.messageCopy"
v-bind:isDismissible="globalAlertMessage.isDismissible"
/>
</template>

View file

@ -66,9 +66,6 @@ export async function navigateToHeritageFunnel() {
{
corid: store.getters.order.referralCorrelationId,
src: "concept-funnel",
// TODO CSR-28, remove this
cns: "all",
experiments: "RemoveServiceAreaPage=ServAreaRemoval_V7=NoShowPackages_CONTROL=true,ConceptFunnel=ConceptFunnel_V1=ConceptFunnel_TEST=true"
}
);
}

View file

@ -26,24 +26,21 @@
</div>
<alert
class="my-3"
cmsWidgetName="NoServiceZipWidget"
v-if="newServiceZipRequired"
alertClass="alert-danger"
:alertHeadline="noServiceZipWidget.headline"
:alertCopy="noServiceZipWidget.copy"
/>
<alert
class="my-3"
cmsWidgetName="NoMatchAlertWidget"
v-if="vinNotValid"
alertClass="alert-danger"
:alertHeadline="noMatchAlertWidget.headline"
:alertCopy="noMatchAlertWidget.copy"
/>
<alert
class="my-3"
cmsWidgetName="MatchedDifferentVehicleAlertWidget"
v-if="vinDoesNotMatchCarId"
alertClass="alert-warning"
:alertHeadline="matchedDifferentVehicleAlertWidget.headline"
:alertCopy="matchedDifferentVehicleAlertWidget.copy"
/>
<div class="row my-2">
<div class="col">
@ -107,18 +104,6 @@ export default {
// Call the "next" function to complete the transition to this page.
next((vm) => {
vm.setCmsContent(resultMap.cmsContent);
vm.noServiceZipWidget = {
headline: resultMap.cmsContent.NoServiceZipWidget.HeadlineText,
copy: resultMap.cmsContent.NoServiceZipWidget.BodyText,
};
vm.noMatchAlertWidget = {
headline: resultMap.cmsContent.NoMatchAlertWidget.HeadlineText,
copy: resultMap.cmsContent.NoMatchAlertWidget.BodyText
};
vm.matchedDifferentVehicleAlertWidget = {
headline: resultMap.cmsContent.MatchedDifferentVehicleAlertWidget.HeadlineText,
copy: resultMap.cmsContent.MatchedDifferentVehicleAlertWidget.BodyText
};
});
},
props: {

View file

@ -814,6 +814,7 @@ function setupMocks({
damageLocationQuestion.methods.initializeComponent;
wrapper.vm.setCmsContent = baseMixin.methods.setCmsContent;
wrapper.vm.blockKeyDownInputFromKeyboard = baseMixin.methods.blockKeyDownInputFromKeyboard;
return { wrapper, apiPromise };
}

View file

@ -24,10 +24,9 @@
/>
<alert
class="my-3"
cmsWidgetName="HasReplacementConflict"
v-show="hasRepairReplaceConflict"
alertClass="alert-danger"
alertHeadline="You'll need to schedule separate appointments"
:alertCopy="['Vehicle service requiring both glass repair and replacement must be scheduled separately, as they\'re performed by different technicians.', 'Continue scheduling your first service now, and then come back to schedule the second service.']"
:isDismissible="false"
/>
<sideDoorOptions
@ -259,6 +258,8 @@ export default {
},
async forwardButtonAction() {
this.blockKeyDownInputFromKeyboard();
store.commit(this.storeMutations.UPDATE_IS_REPAIR, this.isWindshieldRepair);
if (this.isWindshieldRepair){
@ -277,7 +278,7 @@ export default {
navigateForward(partsData){
// CSR-98 TEMP
const vehicleYearsToShowHeritageFunnel = [ "2001", "2002", "2010" ];
const vehicleYearsToShowHeritageFunnel = [ 2001, 2002, 2010 ];
if (vehicleYearsToShowHeritageFunnel.includes(store.getters.vehicle.year)) {
navigateToHeritageFunnel();
return;

View file

@ -9,10 +9,9 @@
/>
<alert
class="my-3"
cmsWidgetName="NoReplacementAvailableError"
v-show="showNoReplacementAvailableError"
alertClass="alert-danger"
alertHeadline="Service not available"
:alertCopy="['We\'re sorry, but we currently offer only repair service for your vehicle type.', 'Need help with next steps? Call us at 800-394-0288.']"
:isDismissible="false"
/>
<windshieldChipCountQuestion cmsWidgetName="WindshieldChipCountQuestion"
@ -31,10 +30,9 @@
/>
<alert
class="my-3"
cmsWidgetName="SplitSingleConflict"
v-show="hasSplitSingleConflict"
alertClass="alert-danger"
alertHeadline="Single-piece or split?"
alertCopy="Please select just one windshield option: single-piece or split."
:isDismissible="false"
/>
</div>
@ -99,9 +97,9 @@ export default ({
},
methods: {
initializeComponent(
windshieldAvailableReplacementOptions){
initializeComponent(windshieldAvailableReplacementOptions){
this.windshieldAvailableReplacementOptions = windshieldAvailableReplacementOptions;
this.$refs.replaceOptionsQuestion.initializeComponent(windshieldAvailableReplacementOptions);
},
getWindshieldOptions(selectedWindshieldDamageType, selectedWindshieldChipCount, selectedWindshieldReplaceOptions){
// ONLY UPDATE THE NEW VALUE IF IT IS TRUTHY (NOT NULL)

View file

@ -9,8 +9,7 @@
<alert
class="rounded border-0 shadow-sm"
alertClass="alert-warning"
:alertHeadline="alertWidgetData.headline"
:alertCopy="alertWidgetData.copy"
cmsWidgetName="AlertWidget"
:isDismissible="false"
/>
</div>
@ -74,13 +73,6 @@ export default {
FeatureQuestionWidget: resultMap.cmsContent.FeatureQuestionWidget,
})
);
// Set alertData for the page alert. These use props so we don't call
// initializeComponent here.
vm.alertWidgetData = {
copy: resultMap.cmsContent.AlertWidget.BodyText,
headline: resultMap.cmsContent.AlertWidget.HeadlineText,
};
});
},
data() {

View file

@ -64,8 +64,8 @@ export default {
watch: {
selectedYear(year) {
this.$store.commit(this.storeMutations.UPDATE_YEAR, year);
const parsedYear = parseInt(year);
this.$store.commit(this.storeMutations.UPDATE_YEAR, parsedYear);
this.$router.navigateAfterSave(
this.navigationScenarios.SELECTED_YEAR,
this.$route

View file

@ -25,6 +25,11 @@ export default {
return store.dispatch(type, payload);
},
blockKeyDownInputFromKeyboard(){
document.onkeydown = function (e) {
return false;
};
},
savePageDataToStore(page, data){
store.commit(storeMutations.UPDATE_PAGE_DATA, { page: page, data: data });
},

View file

@ -34,6 +34,8 @@ const routes = [
path: "/",
name: "root",
async beforeEnter(to, from, next) {
document.onkeydown = null;
// If we have no query string, or we don't have the FmgPage query string.
if (to.query.fmgPage === undefined) {
await GoToFunnelStartOn404(next);

View file

@ -3,28 +3,40 @@ import alert from "./alert";
describe("alert.vue", () => {
it("Should set isMultiParagraph to true if alertCopy is an array of strings", async () => {
it("Should add class 'alert-dismissible' if isDismissible is true", async () => {
// Arrange
const wrapper = shallowMount(alert, {
propsData: {
alertCopy: ["one", "two"]
isDismissible: true
},
mixins: [mockMixin]
});
const wrapperDiv = wrapper.find('div');
// Assert
expect(wrapper.vm.isMultiParagraph).toBe(true);
expect(wrapperDiv.classes()).toContain('alert-dismissible')
});
it("Should set isMultiParagraph to false if alertCopy is a single string", async () => {
it("Should add specified alert class", async () => {
// Arrange
const wrapper = shallowMount(alert, {
propsData: {
alertCopy: "three"
alertClass: 'warning'
},
mixins: [mockMixin]
});
const wrapperDiv = wrapper.find('div');
// Assert
expect(wrapper.vm.isMultiParagraph).toBe(false);
expect(wrapperDiv.classes()).toContain('warning')
});
});
const mockMixin = {
methods: {
getCmsContent: jest.fn()
}
}

View file

@ -5,12 +5,7 @@
:class="[isDismissible ? 'alert-dismissible' : '', this.alertClass]"
>
<p class="m-0 fw-bold small alert-heading">{{ alertHeadline }}</p>
<span v-if="isMultiParagraph">
<p class="m-1 text-body small" v-for="(para, index) in alertCopy" :key="index">
{{ para }}
</p>
</span>
<p class="m-0 text-body small" v-else>{{ alertCopy }}</p>
<p class="m-0 text-body small" v-html="alertCopy"></p>
<button
type="button"
class="btn-close p-2"
@ -34,8 +29,6 @@
export default {
name: "alert",
props: {
alertHeadline: String,
alertCopy: [Array, String],
isDismissible: Boolean,
/*
alertClass class names:
@ -45,14 +38,17 @@ export default {
alert-info (blue)
*/
alertClass: String,
cmsWidgetName: String,
manualHeadline: String,
manualCopy: String,
},
computed: {
isMultiParagraph() {
if (typeof this.alertCopy == "string") {
return false;
}
return true;
}
alertHeadline(){
return this.cmsWidgetName ? this.getCmsContent(this.cmsWidgetName, 'HeadlineText') : this.manualHeadline;
},
alertCopy(){
return this.cmsWidgetName ? this.getCmsContent(this.cmsWidgetName, 'BodyText') : this.manualCopy;
},
},
};
</script>