Merge branch 'release/2026.08.13' into nation/CASH-2801
This commit is contained in:
commit
7c3cb484dd
2 changed files with 64 additions and 3 deletions
|
|
@ -59,13 +59,14 @@ jest.mock("@/helpers/page-prerequisites-helper.js", () => ({
|
||||||
hasInsuranceInfo: jest.fn(() => true),
|
hasInsuranceInfo: jest.fn(() => true),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function setupMocks() {
|
function setupMocks({ isAppleBrowser = false } = {}) {
|
||||||
const dispatchStoreAction = jest.fn().mockResolvedValue(null);
|
const dispatchStoreAction = jest.fn().mockResolvedValue(null);
|
||||||
const baseMixin = {
|
const baseMixin = {
|
||||||
methods: {
|
methods: {
|
||||||
getCmsContent: jest.fn(() => ""),
|
getCmsContent: jest.fn(() => ""),
|
||||||
setCmsContent: jest.fn(),
|
setCmsContent: jest.fn(),
|
||||||
getTotalLineItemPrice: jest.fn(() => 0),
|
getTotalLineItemPrice: jest.fn(() => 0),
|
||||||
|
isAppleBrowser: jest.fn(() => isAppleBrowser),
|
||||||
dispatchStoreAction,
|
dispatchStoreAction,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -411,4 +412,40 @@ describe("scheduling.vue", () => {
|
||||||
wrapper.unmount();
|
wrapper.unmount();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("in-shop Maps link", () => {
|
||||||
|
const address = {
|
||||||
|
city: "Lewis Center",
|
||||||
|
state: "OH",
|
||||||
|
streetAddress: "1343 Cameron Ave",
|
||||||
|
zipCode: "43035",
|
||||||
|
};
|
||||||
|
const query = encodeURIComponent(
|
||||||
|
"safelite,Safelite Autoglass, 1343 Cameron Ave, Lewis Center, OH 43035"
|
||||||
|
);
|
||||||
|
|
||||||
|
test("onInshopAddressClicked opens Maps in a new tab for Google and Apple", () => {
|
||||||
|
const openSpy = jest.spyOn(window, "open").mockImplementation(() => null);
|
||||||
|
|
||||||
|
const { wrapper } = setupMocks();
|
||||||
|
wrapper.vm.onInshopAddressClicked({ address });
|
||||||
|
expect(openSpy).toHaveBeenCalledWith(
|
||||||
|
`https://www.google.com/maps/search/?api=1&query=${query}`,
|
||||||
|
"_blank",
|
||||||
|
"noopener,noreferrer"
|
||||||
|
);
|
||||||
|
wrapper.unmount();
|
||||||
|
|
||||||
|
openSpy.mockClear();
|
||||||
|
const { wrapper: appleWrapper } = setupMocks({ isAppleBrowser: true });
|
||||||
|
appleWrapper.vm.onInshopAddressClicked({ address });
|
||||||
|
expect(openSpy).toHaveBeenCalledWith(
|
||||||
|
`https://maps.apple.com/?q=${query}`,
|
||||||
|
"_blank",
|
||||||
|
"noopener,noreferrer"
|
||||||
|
);
|
||||||
|
appleWrapper.unmount();
|
||||||
|
openSpy.mockRestore();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,7 @@ const SCHEDULING_RADIO_GROUP_NAME = "schedulingTimeSlot";
|
||||||
const INITIAL_INSHOP_PROVIDER_COUNT = 3;
|
const INITIAL_INSHOP_PROVIDER_COUNT = 3;
|
||||||
const MAX_INSHOP_PROVIDERS = 9;
|
const MAX_INSHOP_PROVIDERS = 9;
|
||||||
const VIEW_MORE_SHOPS_BATCH_SIZE = 3;
|
const VIEW_MORE_SHOPS_BATCH_SIZE = 3;
|
||||||
|
const INSHOP_MAPS_PLACE_NAME = "safelite,Safelite Autoglass";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Appends days from newSlots into entry.timeSlots, initializing it if absent.
|
* Appends days from newSlots into entry.timeSlots, initializing it if absent.
|
||||||
|
|
@ -471,9 +472,32 @@ export default {
|
||||||
const day = providerEntry?.timeSlots?.days?.find((d) => d.date === this.selectedDate);
|
const day = providerEntry?.timeSlots?.days?.find((d) => d.date === this.selectedDate);
|
||||||
return day?.timeSlots ?? [];
|
return day?.timeSlots ?? [];
|
||||||
},
|
},
|
||||||
|
buildInshopMapsQuery(address) {
|
||||||
|
const streetAddress = address?.streetAddress?.trim();
|
||||||
|
if (!streetAddress) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const street = [streetAddress, address.streetAddress2?.trim()]
|
||||||
|
.filter(Boolean)
|
||||||
|
.join(" ");
|
||||||
|
return `${INSHOP_MAPS_PLACE_NAME}, ${street}, ${address.city}, ${address.state} ${address.zipCode}`;
|
||||||
|
},
|
||||||
|
buildInshopMapsUrl(address) {
|
||||||
|
const query = this.buildInshopMapsQuery(address);
|
||||||
|
if (!query) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (this.isAppleBrowser()) {
|
||||||
|
return `https://maps.apple.com/?q=${encodeURIComponent(query)}`;
|
||||||
|
}
|
||||||
|
return `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(query)}`;
|
||||||
|
},
|
||||||
onInshopAddressClicked(provider) {
|
onInshopAddressClicked(provider) {
|
||||||
// TODO: open Google Maps when address link functionality is implemented
|
const url = this.buildInshopMapsUrl(provider?.address);
|
||||||
console.log("onInshopAddressClicked", provider?.providerNumber);
|
if (!url) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
window.open(url, "_blank", "noopener,noreferrer");
|
||||||
},
|
},
|
||||||
onMobileZipCodeClicked() {
|
onMobileZipCodeClicked() {
|
||||||
this.$refs.schedulingZipSearch?.focusZipInput();
|
this.$refs.schedulingZipSearch?.focusZipInput();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue