Merge pull request #627 from Safelite/feature/digital/1067.1

SSR-1067 Payment Page Cart Bug Fixes
This commit is contained in:
Josh Dassinger 2024-04-18 15:15:45 -05:00 committed by GitHub
commit eba9008743
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 45 additions and 4 deletions

View file

@ -65,7 +65,7 @@
<div class="py-1 d-flex justify-content-between align-items-center"> <div class="py-1 d-flex justify-content-between align-items-center">
<span>{{ item?.name ?? '' }}</span> <span>{{ item?.name ?? '' }}</span>
<textLink <textLink
v-if="!readOnly || !showAsPaid" v-if="!readOnly"
linkType="text" linkType="text"
text="Remove" text="Remove"
href="javascript:void(0)" href="javascript:void(0)"
@ -100,7 +100,7 @@
</div> </div>
<textLink <textLink
v-if="item.cartItemType === cartItemType.VAP v-if="item.cartItemType === cartItemType.VAP
&& (!readOnly || !showAsPaid)" && !readOnly"
linkType="text" linkType="text"
text="Remove" text="Remove"
href="javascript:void(0)" href="javascript:void(0)"

View file

@ -7,6 +7,7 @@ import { getMountOptions } from '@/helpers/unit-test-helper';
import { useMainStore } from '@/store'; import { useMainStore } from '@/store';
import { paymentMethods, hopPaymentMethods } from '@/constants/payment-method-constants.js'; import { paymentMethods, hopPaymentMethods } from '@/constants/payment-method-constants.js';
import queryStrings from '@/constants/query-strings'; import queryStrings from '@/constants/query-strings';
import CartDropdown from '@/iss-components/cart-dropdown/cart-dropdown.vue';
// Constants // Constants
const parts = { const parts = {
@ -316,6 +317,44 @@ describe('payment-page.vue', () => {
}); });
}); });
describe('cart-dropdown', () => {
test('Show cart dropdown if credit card', async () => {
const wrapper = setupMocks({});
wrapper.vm.paymentType = hopPaymentMethods.CREDIT_CARD;
// Act
await wrapper.vm.$nextTick();
const cartTable = wrapper.findComponent(CartDropdown);
// Assert
expect(cartTable.exists()).toBeTruthy();
});
test('Hide cart dropdown if afterpay', async () => {
const wrapper = setupMocks({});
wrapper.vm.paymentType = hopPaymentMethods.AFTERPAY;
// Act
await wrapper.vm.$nextTick();
const cartTable = wrapper.findComponent(CartDropdown);
// Assert
expect(cartTable.exists()).toBeFalsy();
});
test('Hide cart dropdown if paypal', async () => {
const wrapper = setupMocks({});
wrapper.vm.paymentType = hopPaymentMethods.PAYPAL;
// Act
await wrapper.vm.$nextTick();
const cartTable = wrapper.findComponent(CartDropdown);
// Assert
expect(cartTable.exists()).toBeFalsy();
});
});
describe('isPaypal', () => { describe('isPaypal', () => {
test('Is responsive if initial data changes', async () => { test('Is responsive if initial data changes', async () => {
// Arrange // Arrange

View file

@ -41,9 +41,8 @@
@ForwardClicked="forwardButtonAction" @ForwardClicked="forwardButtonAction"
@backClicked="backButtonAction" /> @backClicked="backButtonAction" />
<div class="px-2"> <div v-if="isCreditCard" class="px-2">
<cartDropdown <cartDropdown
:showAsPaid="false"
:readOnly="true" :readOnly="true"
:showDropdownHeader="false" :showDropdownHeader="false"
:isInitiallyExpanded="true" :isInitiallyExpanded="true"
@ -525,6 +524,9 @@ export default {
isPaypal() { isPaypal() {
return this.paymentType === hopPaymentMethods.PAYPAL; return this.paymentType === hopPaymentMethods.PAYPAL;
}, },
isCreditCard() {
return this.paymentType === hopPaymentMethods.CREDIT_CARD;
},
displayPayInAdvanceCreditCardAlert() { displayPayInAdvanceCreditCardAlert() {
return this.displayPayInAdvanceAlert(paymentMethods.CREDIT_CARD); return this.displayPayInAdvanceAlert(paymentMethods.CREDIT_CARD);
}, },