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),
|
||||
}));
|
||||
|
||||
function setupMocks() {
|
||||
function setupMocks({ isAppleBrowser = false } = {}) {
|
||||
const dispatchStoreAction = jest.fn().mockResolvedValue(null);
|
||||
const baseMixin = {
|
||||
methods: {
|
||||
getCmsContent: jest.fn(() => ""),
|
||||
setCmsContent: jest.fn(),
|
||||
getTotalLineItemPrice: jest.fn(() => 0),
|
||||
isAppleBrowser: jest.fn(() => isAppleBrowser),
|
||||
dispatchStoreAction,
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -411,4 +412,40 @@ describe("scheduling.vue", () => {
|
|||
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 MAX_INSHOP_PROVIDERS = 9;
|
||||
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.
|
||||
|
|
@ -471,9 +472,32 @@ export default {
|
|||
const day = providerEntry?.timeSlots?.days?.find((d) => d.date === this.selectedDate);
|
||||
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) {
|
||||
// TODO: open Google Maps when address link functionality is implemented
|
||||
console.log("onInshopAddressClicked", provider?.providerNumber);
|
||||
const url = this.buildInshopMapsUrl(provider?.address);
|
||||
if (!url) {
|
||||
return;
|
||||
}
|
||||
window.open(url, "_blank", "noopener,noreferrer");
|
||||
},
|
||||
onMobileZipCodeClicked() {
|
||||
this.$refs.schedulingZipSearch?.focusZipInput();
|
||||
|
|
|
|||
Loading…
Reference in a new issue