Merge branch 'develop' into feature/CSR-803-refactoring-2

This commit is contained in:
Adam Caouette 2022-10-04 07:38:44 -04:00
commit 6e06c32c50
8 changed files with 102 additions and 6 deletions

View file

@ -26,7 +26,7 @@ resources:
type: github type: github
name: Safelite/AzureDevOps name: Safelite/AzureDevOps
endpoint: Safelite endpoint: Safelite
ref: refs/tags/t5.5.19 ref: refs/tags/t5.5.31
variables: variables:
- group: Digital-Infrastructure - group: Digital-Infrastructure
@ -173,5 +173,6 @@ stages:
cfDistributionId: $(cfDistributionId) cfDistributionId: $(cfDistributionId)
- template: templates/digital/auto-tag.yml@AzureDevOps - template: templates/digital/auto-tag.yml@AzureDevOps
parameters: parameters:
dependsOn: prodBuildDeployment
userName: SafeliteAzureDevops userName: SafeliteAzureDevops
userEmail: githubazuredevops@safelite.com userEmail: githubazuredevops@safelite.com

View file

@ -60,6 +60,11 @@ export default {
ul { ul {
margin-bottom: 0; margin-bottom: 0;
} }
p {
&:last-child {
margin-bottom: 0;
}
}
} }
} }
} }

View file

@ -50,6 +50,7 @@ export async function navigateToHeritageFunnel(shouldSaveOrder = true) {
{ {
corid: store.getters.order.referralCorrelationId, corid: store.getters.order.referralCorrelationId,
src: "concept-funnel", src: "concept-funnel",
conceptsqid: store.getters.applicationUser.savedSessionId
} }
); );
} }

View file

@ -0,0 +1,57 @@
import { shallowMount } from "@vue/test-utils";
import CashOrInsuranceQuestion from "./cash-or-insurance-question";
describe("cash-or-insurance-question.vue", () => {
it("Should emit a false boolean value when selectedValues is 'CashAnswer' (update:modelValue)", async () => {
//Arrange
const wrapper = shallowMount(CashOrInsuranceQuestion, {
propsData: mockProps,
mixins: [mockMixin]
});
//Act
wrapper.vm.selectedValues = "CashAnswer";
await wrapper.vm.$nextTick();
//Assert
expect(wrapper.emitted()["update:modelValue"][0]).toEqual([false]);
expect(typeof wrapper.emitted()["update:modelValue"][0][0]).toBe("boolean");
});
it("Should return 'CashAnswer' from selectedValues when modelValue is set to false", async () => {
//Arrange
const wrapper = shallowMount(CashOrInsuranceQuestion, {
propsData: mockProps,
mixins: [mockMixin]
});
//Act
wrapper.setProps({modelValue : false});
await wrapper.vm.$nextTick();
//Assert
expect(wrapper.vm.selectedValues).toBe("CashAnswer");
});
});
///////////////
// Constants //
///////////////
const mockMixin = {
methods: {
getCmsContent: jest.fn((widgetName, cmsFieldName) => {
return mockCmsContent[cmsFieldName];
})
}
}
const mockProps = {
modelValue: true,
}
const mockCmsContent = {
'Text': "Sample text here.",
}

View file

@ -14,6 +14,9 @@
<script> <script>
import buttonQuestion from "@/common-components/button-question/button-question"; import buttonQuestion from "@/common-components/button-question/button-question";
const cashAnswer = "CashAnswer";
const insuranceAnswer = "InsuranceAnswer";
export default ({ export default ({
name: "cashOrInsuranceQuestion", name: "cashOrInsuranceQuestion",
props: { props: {
@ -23,17 +26,18 @@ export default ({
}, },
computed: { computed: {
answersFromCms(){ answersFromCms(){
//console.log(JSON.parse(JSON.stringify(this.getCmsContent(this.cmsWidgetName, 'Answers'))));
return this.getCmsContent(this.cmsWidgetName, 'Answers'); return this.getCmsContent(this.cmsWidgetName, 'Answers');
}, },
selectedValues: { selectedValues: {
get: function() { get: function() {
// Convert to CMS answer name from bool // Convert to CMS answer name from bool
var cmsAnswerValue = this.modelValue ? "InsuranceAnswer" : "CashAnswer"; var cmsAnswerValue = this.modelValue ? insuranceAnswer : cashAnswer;
return cmsAnswerValue; return cmsAnswerValue;
}, },
set: function(newValue) { set: function(newValue) {
// Convert back to bool for parent component // Convert back to bool for parent component
this.$emit("update:modelValue", newValue === "InsuranceAnswer"); this.$emit("update:modelValue", newValue === insuranceAnswer);
} }
}, },
}, },

View file

@ -133,19 +133,43 @@ export default {
// Call APIs // Call APIs
const cmsContent = await fetchCmsContentForPage(to.query.fmgPage); const cmsContent = await fetchCmsContentForPage(to.query.fmgPage);
// TODOS - modify as needed, just a rough sketch to place initializations
// get supporting lineitems
// get wiper and rain defense lineitems
// Settle promises and get results
// get price of supporting, rain defense & wipers, and parts
// Settle pricing promise and get results
// Call the "next" function to complete the transition to this page. // Call the "next" function to complete the transition to this page.
next((vm) => { next((vm) => {
vm.setCmsContent(cmsContent); vm.setCmsContent(cmsContent);
vm.isInsurance = vm.getDefaultIsInsuranceValue();
}); });
}, },
data(){ data(){
return { return {
isInsurance: false, cashOrInsuranceThreshhold: 600,
pricingRequestResult: null,
isInsurance: null,
} }
}, },
methods: { methods: {
arePagePrerequisitesValid() { arePagePrerequisitesValid() {
return store.getters.order.damage.isRepair || (store.getters.order.lineItems?.glassParts != null && store.getters.order.lineItems.glassParts.length > 0); return store.getters.order.damage.isRepair || (store.getters.order.lineItems?.glassParts != null && store.getters.order.lineItems.glassParts.length > 0);
},
getDefaultIsInsuranceValue() {
var defaultIsInsuranceValue = this.$store.getters.order.payment.isInsurance;
if(defaultIsInsuranceValue != null) {
return defaultIsInsuranceValue;
} else {
return this.economyPackagePrice > this.cashOrInsuranceThreshhold;
}
} }
}, },
computed: { computed: {
@ -155,6 +179,10 @@ export default {
answersFromCms() { answersFromCms() {
return ["Pay on my own", "Pay with insurance"]; return ["Pay on my own", "Pay with insurance"];
}, },
economyPackagePrice() {
//TODO build out the pricing logic CSR-504
return 0;
},
selectedChipCountValues: { selectedChipCountValues: {
get: function() { get: function() {
return this.modelValue; return this.modelValue;

View file

@ -194,7 +194,7 @@ describe("list-button-horizontal.vue", () => {
}); });
wrapper.vm.handleCheckChange(); wrapper.vm.handleCheckChange();
// Assert // Assert
expect(wrapper.emitted()["isCheckedChanged"][0]).toEqual([{value: "List Card Checkbox", checkValue: Boolean, buttonId: undefined, checkValue: undefined}]); expect(wrapper.emitted()["isCheckedChanged"][0]).toEqual([{value: "List Card Checkbox", checkValue: Boolean, buttonId: undefined, checkValue: false}]);
}); });
it("Should set checkValue data if selectedButtonIDs has value(s)", async () => { it("Should set checkValue data if selectedButtonIDs has value(s)", async () => {

View file

@ -85,7 +85,7 @@ export default {
: this.selectedValues[0] == this.value; : this.selectedValues[0] == this.value;
} }
else { else {
this.checkValue = this.selectedValues; this.checkValue = this.selectedValues === this.value;
} }
}, },
methods: { methods: {