This commit is contained in:
Michaela Brydon 2024-03-29 11:20:15 -04:00
parent ca31c4e8d7
commit 799318b02b
2 changed files with 26 additions and 17 deletions

View file

@ -1377,7 +1377,9 @@ describe('cart-dropdown component', () => {
});
});
describe.todo('removeItem', () => {
test('when isVap false, updateVaps not called', () => {});
test('when isVap false, updateVaps not called', () => {
});
test('when isVap true, vapsInOrder is expected', () => {});
test('when isVap true and vapsInOrder null, vapsInOrder becomes []', () => {});
});

View file

@ -93,18 +93,16 @@
<span v-else>{{ item?.name ?? '' }}</span>
<span>{{ getDisplayed(item?.subTotal ?? 0, false) }}</span>
</div>
<div class="px-5">
<textLink
v-if="item.isRemovable && (!readOnly || !showAsPaid)"
linkType="text"
text="Remove"
href="javascript:void(0)"
@clickEvent="removeItem(item.partType, item.isVap)">
<template #after-text>
<span class="sr-only">{{ item?.name ?? '' }}</span>
</template>
</textLink>
</div>
<textLink
v-if="item.isRemovable && (!readOnly || !showAsPaid)"
linkType="text"
text="Remove"
href="javascript:void(0)"
@clickEvent="removeItem(item.partType, item.isVap)">
<template #after-text>
<span class="sr-only">{{ item?.name ?? '' }}</span>
</template>
</textLink>
</div>
</div>
<div
@ -268,11 +266,20 @@ export default {
return items;
},
nonServicePackageCartItems() {
const vapsLineItemsNotInPackage = this.vapsInOrder
?.filter((vap) => !this.partTypesInServicePackage.includes(vap.partType))
const partTypesInOrder = this.vapsInOrder.reduce(
(accumulator, vap) => {
if (!accumulator.includes(vap.partType)) {
accumulator.push(vap.partType);
}
return accumulator;
},
[]
);
const partTypesInOrderButNotPackage = partTypesInOrder
.filter((partType) => !this.partTypesInServicePackage.includes(partType))
?? [];
const vapsCartItemsNotInPackage = vapsLineItemsNotInPackage.map((lineItem) => {
switch (lineItem.partType) {
const vapsCartItemsNotInPackage = partTypesInOrderButNotPackage.map((partType) => {
switch (partType) {
case partTypeStrings.FRONT_WIPER:
return this.frontWipersCartItem;
case partTypeStrings.REAR_WIPER: