@meetelise/chat 1.75.0 → 1.77.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/WebComponent/Scheduler/time-picker.d.ts +6 -0
- package/dist/src/WebComponent/Scheduler/tour-type-option.d.ts +1 -1
- package/dist/src/WebComponent/SchedulerV2/contact-form.d.ts +9 -3
- package/dist/src/WebComponent/SchedulerV2/itinerary-editor.d.ts +38 -3
- package/dist/src/WebComponent/SchedulerV2/itineraryStopStyles.d.ts +1 -2
- package/dist/src/WebComponent/SchedulerV2/scheduler-popover.d.ts +18 -1
- package/dist/src/WebComponent/SchedulerV2/schedulerIcons.d.ts +18 -0
- package/dist/src/WebComponent/SchedulerV2/schedulerV2Styles.d.ts +9 -0
- package/dist/src/WebComponent/SchedulerV2/tour-scheduler-v2.d.ts +13 -1
- package/dist/src/WebComponent/SchedulerV2/tourTimes.d.ts +1 -1
- package/dist/src/WebComponent/actions/international-phone-input.d.ts +7 -0
- package/dist/src/WebComponent/me-select.d.ts +2 -0
- package/package.json +1 -1
- package/public/dist/index.js +2449 -1336
- package/src/WebComponent/Scheduler/date-picker.ts +130 -51
- package/src/WebComponent/Scheduler/time-picker.ts +62 -0
- package/src/WebComponent/Scheduler/tour-type-option.ts +31 -10
- package/src/WebComponent/SchedulerV2/booking-confirmation.ts +42 -38
- package/src/WebComponent/SchedulerV2/community-picker.ts +222 -160
- package/src/WebComponent/SchedulerV2/contact-form.ts +100 -70
- package/src/WebComponent/SchedulerV2/itinerary-editor.ts +498 -168
- package/src/WebComponent/SchedulerV2/itineraryStopStyles.ts +44 -21
- package/src/WebComponent/SchedulerV2/scheduler-popover.ts +105 -9
- package/src/WebComponent/SchedulerV2/schedulerIcons.ts +143 -0
- package/src/WebComponent/SchedulerV2/schedulerV2Styles.ts +347 -0
- package/src/WebComponent/SchedulerV2/tour-scheduler-v2.ts +443 -175
- package/src/WebComponent/SchedulerV2/tourTimes.ts +4 -3
- package/src/WebComponent/actions/action-confirm-button.ts +4 -3
- package/src/WebComponent/actions/international-phone-input.ts +84 -1
- package/src/WebComponent/me-select.ts +74 -0
- package/src/tourSchedulerV2Booking.test.ts +145 -15
|
@@ -38,15 +38,16 @@ export const formatHourMinute = (hourMinute: string): string => {
|
|
|
38
38
|
export const formatTime = (iso: string): string =>
|
|
39
39
|
formatHourMinute(isoHourMinute(iso));
|
|
40
40
|
|
|
41
|
-
/** "10:00–10:
|
|
41
|
+
/** "10:00–10:30 AM", or "11:30 AM–12:00 PM" across noon, as the design writes a stop's time. */
|
|
42
42
|
export const formatTimeRange = (startIso: string, endIso: string): string => {
|
|
43
43
|
const start = parts(isoHourMinute(startIso));
|
|
44
44
|
const end = parts(isoHourMinute(endIso));
|
|
45
|
+
const upper = (hour: number) => meridiem(hour).toUpperCase();
|
|
45
46
|
const startText =
|
|
46
47
|
meridiem(start.hour) === meridiem(end.hour)
|
|
47
48
|
? clock(start.hour, start.minute)
|
|
48
|
-
:
|
|
49
|
-
return `${startText}–${
|
|
49
|
+
: `${clock(start.hour, start.minute)} ${upper(start.hour)}`;
|
|
50
|
+
return `${startText}–${clock(end.hour, end.minute)} ${upper(end.hour)}`;
|
|
50
51
|
};
|
|
51
52
|
|
|
52
53
|
/** A calendar date, read as that date wherever the visitor is. */
|
|
@@ -20,9 +20,10 @@ export class ActionConfirmButton extends LitElement {
|
|
|
20
20
|
background: var(--action-confirm-button-background, #000000);
|
|
21
21
|
border: none;
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
/* Today's pill unless a surrounding page sets these, as the v2 scheduler does. */
|
|
24
|
+
border-radius: var(--action-confirm-button-radius, 20px);
|
|
24
25
|
|
|
25
|
-
font-family: "Helvetica Neue", Arial;
|
|
26
|
+
font-family: var(--action-confirm-button-font, "Helvetica Neue", Arial);
|
|
26
27
|
font-style: normal;
|
|
27
28
|
font-weight: 400;
|
|
28
29
|
font-size: 12px;
|
|
@@ -34,7 +35,7 @@ export class ActionConfirmButton extends LitElement {
|
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
.action-confirm-button:disabled {
|
|
37
|
-
background: #e7e7e7;
|
|
38
|
+
background: var(--action-confirm-button-disabled-background, #e7e7e7);
|
|
38
39
|
box-shadow: none;
|
|
39
40
|
cursor: initial;
|
|
40
41
|
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
css,
|
|
3
|
+
html,
|
|
4
|
+
LitElement,
|
|
5
|
+
nothing,
|
|
6
|
+
PropertyValues,
|
|
7
|
+
TemplateResult,
|
|
8
|
+
} from "lit";
|
|
2
9
|
import { customElement, property, state } from "lit/decorators.js";
|
|
3
10
|
import { classMap } from "lit/directives/class-map.js";
|
|
4
11
|
import { InputStyles } from "./InputStyles";
|
|
@@ -126,9 +133,77 @@ export class InternationalPhoneInput extends LitElement {
|
|
|
126
133
|
flex-basis: 92px;
|
|
127
134
|
}
|
|
128
135
|
}
|
|
136
|
+
|
|
137
|
+
/* Only with the outlined attribute: the v2 scheduler's white field. */
|
|
138
|
+
:host([outlined]) .phone-input-container {
|
|
139
|
+
background: #ffffff;
|
|
140
|
+
border: 1px solid #dee2e6;
|
|
141
|
+
border-radius: 4px;
|
|
142
|
+
min-height: 36px;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
:host([outlined]) .phone-input-container:focus-within {
|
|
146
|
+
border-color: var(--primary-color, #646987);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
:host([outlined]) .phone-input-container--invalid,
|
|
150
|
+
:host([outlined]) .phone-input-container--invalid:focus-within {
|
|
151
|
+
border-color: #dc2626;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
:host([outlined]) .country-select-wrapper {
|
|
155
|
+
flex: 0 0 auto;
|
|
156
|
+
height: 34px;
|
|
157
|
+
padding: 0 12px;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
:host([outlined]) .country-select-wrapper::after {
|
|
161
|
+
border-bottom: 1px solid #212529;
|
|
162
|
+
border-right: 1px solid #212529;
|
|
163
|
+
height: 6px;
|
|
164
|
+
margin-left: 10px;
|
|
165
|
+
width: 6px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
:host([outlined]) .country-select-label,
|
|
169
|
+
:host([outlined]) .phone-input-container input.webchat-input {
|
|
170
|
+
color: #000000;
|
|
171
|
+
font-family: inherit;
|
|
172
|
+
font-size: 12px;
|
|
173
|
+
line-height: 16px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
:host([outlined]) .phone-input-divider {
|
|
177
|
+
background: #dee2e6;
|
|
178
|
+
height: 20px;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
:host([outlined]) .phone-input-container input.webchat-input {
|
|
182
|
+
padding: 0 12px;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
:host([outlined]) input.webchat-input::placeholder {
|
|
186
|
+
color: #adb5bd;
|
|
187
|
+
font-family: inherit;
|
|
188
|
+
font-size: 12px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/* Phones, including landscape ones (the widget's isMobile): 16px text,
|
|
192
|
+
so focusing the field doesn't zoom the page. */
|
|
193
|
+
@media screen and (max-width: 767px), screen and (max-height: 400px) {
|
|
194
|
+
:host([outlined]) .country-select-label,
|
|
195
|
+
:host([outlined]) .phone-input-container input.webchat-input,
|
|
196
|
+
:host([outlined]) input.webchat-input::placeholder {
|
|
197
|
+
font-size: 16px;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
129
200
|
`,
|
|
130
201
|
];
|
|
131
202
|
|
|
203
|
+
/** The v2 scheduler's look: a white field with a thin border, as its other inputs. */
|
|
204
|
+
@property({ type: Boolean, reflect: true })
|
|
205
|
+
outlined = false;
|
|
206
|
+
|
|
132
207
|
@property({ attribute: false })
|
|
133
208
|
country: string | null = null;
|
|
134
209
|
|
|
@@ -141,6 +216,13 @@ export class InternationalPhoneInput extends LitElement {
|
|
|
141
216
|
@property({ type: String })
|
|
142
217
|
placeholder = "Phone";
|
|
143
218
|
|
|
219
|
+
/**
|
|
220
|
+
* The number field's accessible name, for a form that labels it above
|
|
221
|
+
* rather than with the placeholder. Left empty, the placeholder names it.
|
|
222
|
+
*/
|
|
223
|
+
@property({ type: String })
|
|
224
|
+
label = "";
|
|
225
|
+
|
|
144
226
|
@state()
|
|
145
227
|
private selectedCountry = "US";
|
|
146
228
|
|
|
@@ -278,6 +360,7 @@ export class InternationalPhoneInput extends LitElement {
|
|
|
278
360
|
type="tel"
|
|
279
361
|
inputmode="tel"
|
|
280
362
|
placeholder=${this.placeholder}
|
|
363
|
+
aria-label=${this.label || nothing}
|
|
281
364
|
name="phone"
|
|
282
365
|
autocomplete="tel-national"
|
|
283
366
|
maxlength="30"
|
|
@@ -20,6 +20,10 @@ export class MESelect extends LitElement {
|
|
|
20
20
|
@property({ type: String })
|
|
21
21
|
value?: string;
|
|
22
22
|
|
|
23
|
+
/** The v2 scheduler's look: a white field with a thin border. */
|
|
24
|
+
@property({ type: Boolean, reflect: true })
|
|
25
|
+
outlined = false;
|
|
26
|
+
|
|
23
27
|
@state()
|
|
24
28
|
private activeOption: MeSelectOption | null = null;
|
|
25
29
|
|
|
@@ -228,6 +232,76 @@ export class MESelect extends LitElement {
|
|
|
228
232
|
}
|
|
229
233
|
`,
|
|
230
234
|
InputStyles,
|
|
235
|
+
css`
|
|
236
|
+
/* Only with the outlined attribute: the v2 scheduler's white field. */
|
|
237
|
+
:host([outlined]) #select {
|
|
238
|
+
background: #ffffff;
|
|
239
|
+
border: 1px solid #dee2e6;
|
|
240
|
+
border-radius: 4px;
|
|
241
|
+
box-sizing: border-box;
|
|
242
|
+
color: #adb5bd;
|
|
243
|
+
font-family: inherit;
|
|
244
|
+
height: 36px;
|
|
245
|
+
padding: 0 12px;
|
|
246
|
+
width: 100%;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
:host([outlined]) #select:focus-within {
|
|
250
|
+
border-color: var(--primary-color, #646987);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
:host([outlined]) #selectText {
|
|
254
|
+
color: #000000;
|
|
255
|
+
font-family: inherit;
|
|
256
|
+
font-size: 12px;
|
|
257
|
+
line-height: 16px;
|
|
258
|
+
height: 16px;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
:host([outlined]) #selectText::placeholder {
|
|
262
|
+
color: #adb5bd;
|
|
263
|
+
font-family: inherit;
|
|
264
|
+
font-size: 12px;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
:host([outlined]) ul {
|
|
268
|
+
border: 1px solid #dee2e6;
|
|
269
|
+
border-radius: 8px;
|
|
270
|
+
box-shadow: 0 2px 16px 0 rgba(0, 0, 0, 0.13);
|
|
271
|
+
font-family: inherit;
|
|
272
|
+
font-size: 12px;
|
|
273
|
+
line-height: 16px;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
:host([outlined]) .option {
|
|
277
|
+
padding: 8px 12px;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
:host([outlined]) .option:first-child {
|
|
281
|
+
border-top-left-radius: 8px;
|
|
282
|
+
border-top-right-radius: 8px;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
:host([outlined]) .option:last-child {
|
|
286
|
+
border-bottom-left-radius: 8px;
|
|
287
|
+
border-bottom-right-radius: 8px;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/* Phones, including landscape ones (the widget's isMobile): 16px text,
|
|
291
|
+
so focusing the field doesn't zoom the page. */
|
|
292
|
+
@media screen and (max-width: 767px), screen and (max-height: 400px) {
|
|
293
|
+
:host([outlined]) #selectText,
|
|
294
|
+
:host([outlined]) #selectText::placeholder {
|
|
295
|
+
font-size: 16px;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/* A line as tall as the type would clip its descenders. */
|
|
299
|
+
:host([outlined]) #selectText {
|
|
300
|
+
height: 20px;
|
|
301
|
+
line-height: 20px;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
`,
|
|
231
305
|
];
|
|
232
306
|
|
|
233
307
|
firstUpdated = (): void => {
|
|
@@ -371,6 +371,27 @@ const bookAndAddLinden = async (scheduler: TourSchedulerV2) => {
|
|
|
371
371
|
);
|
|
372
372
|
};
|
|
373
373
|
|
|
374
|
+
/** "Add another stop", then Cedar & Main from the nearby communities. */
|
|
375
|
+
const addCedar = async (
|
|
376
|
+
scheduler: TourSchedulerV2,
|
|
377
|
+
editor: ItineraryEditor
|
|
378
|
+
) => {
|
|
379
|
+
editor.shadowRoot?.querySelector<HTMLButtonElement>(".add-stop")?.click();
|
|
380
|
+
const picker = await waitFor(() =>
|
|
381
|
+
inScheduler<CommunityPicker>(scheduler, ".add-stop-picker community-picker")
|
|
382
|
+
);
|
|
383
|
+
await picker.updateComplete;
|
|
384
|
+
const cedar = await waitFor(() =>
|
|
385
|
+
Array.from(
|
|
386
|
+
picker.shadowRoot?.querySelectorAll<HTMLButtonElement>(
|
|
387
|
+
"button.floorplan-image-card"
|
|
388
|
+
) ?? []
|
|
389
|
+
).find((card) => card.textContent?.includes("Cedar & Main"))
|
|
390
|
+
);
|
|
391
|
+
cedar.click();
|
|
392
|
+
await waitFor(() => editor.stops.some((stop) => stop.building_id === CEDAR));
|
|
393
|
+
};
|
|
394
|
+
|
|
374
395
|
afterEach(() => {
|
|
375
396
|
restore();
|
|
376
397
|
document.querySelectorAll("tour-scheduler-v2").forEach((el) => el.remove());
|
|
@@ -477,6 +498,12 @@ it("moves an added stop to its own day, keeping the booked tour's day, adds the
|
|
|
477
498
|
"Change the date or time at The Linden"
|
|
478
499
|
);
|
|
479
500
|
edit.click();
|
|
501
|
+
const dateField = await waitFor(() =>
|
|
502
|
+
editor.shadowRoot?.querySelector<HTMLButtonElement>(
|
|
503
|
+
`#stop-date-trigger-${LINDEN}`
|
|
504
|
+
)
|
|
505
|
+
);
|
|
506
|
+
dateField.click();
|
|
480
507
|
const picker = await waitFor(() =>
|
|
481
508
|
editor.shadowRoot?.querySelector<HTMLElement & { selectedDate?: Date }>(
|
|
482
509
|
"date-picker"
|
|
@@ -529,6 +556,88 @@ it("moves an added stop to its own day, keeping the booked tour's day, adds the
|
|
|
529
556
|
]);
|
|
530
557
|
});
|
|
531
558
|
|
|
559
|
+
it("opens a stop's date and time panel from its pencil, closes it on Escape or a picked time, and returns focus to the pencil", async () => {
|
|
560
|
+
const { plans } = fakeBackend();
|
|
561
|
+
const scheduler = mount();
|
|
562
|
+
await bookAndAddLinden(scheduler);
|
|
563
|
+
const editor = await waitFor(() =>
|
|
564
|
+
inScheduler<ItineraryEditor>(scheduler, "itinerary-editor")
|
|
565
|
+
);
|
|
566
|
+
const inEditor = <T extends Element>(selector: string) =>
|
|
567
|
+
editor.shadowRoot?.querySelector<T>(selector) ?? null;
|
|
568
|
+
const pencil = await waitFor(() =>
|
|
569
|
+
inEditor<HTMLButtonElement>(`.edit-time[data-building-id="${LINDEN}"]`)
|
|
570
|
+
);
|
|
571
|
+
const popover = pencil.closest<HTMLElement & { open: boolean }>(
|
|
572
|
+
"scheduler-popover"
|
|
573
|
+
);
|
|
574
|
+
// The booked stop has no pencil.
|
|
575
|
+
expect(editor.shadowRoot?.querySelectorAll(".edit-time").length).to.equal(1);
|
|
576
|
+
|
|
577
|
+
pencil.click();
|
|
578
|
+
await editor.updateComplete;
|
|
579
|
+
expect(popover?.open).to.equal(true);
|
|
580
|
+
expect(pencil.getAttribute("aria-expanded")).to.equal("true");
|
|
581
|
+
const panel = inEditor(`#${pencil.getAttribute("aria-controls")}`);
|
|
582
|
+
expect(panel?.getAttribute("aria-label")).to.equal(
|
|
583
|
+
"Date and time at The Linden"
|
|
584
|
+
);
|
|
585
|
+
// Another time than the stop's, once the picker has marked the stop's.
|
|
586
|
+
const laterTime = () =>
|
|
587
|
+
waitFor(() => {
|
|
588
|
+
const options = panel
|
|
589
|
+
?.querySelector("time-picker")
|
|
590
|
+
?.shadowRoot?.querySelectorAll<HTMLButtonElement>(".option");
|
|
591
|
+
return (
|
|
592
|
+
options &&
|
|
593
|
+
Array.from(options).some((o) => o.classList.contains("selected")) &&
|
|
594
|
+
Array.from(options).find((o) => !o.classList.contains("selected"))
|
|
595
|
+
);
|
|
596
|
+
});
|
|
597
|
+
const later = await laterTime();
|
|
598
|
+
|
|
599
|
+
later.dispatchEvent(
|
|
600
|
+
new KeyboardEvent("keydown", {
|
|
601
|
+
key: "Escape",
|
|
602
|
+
bubbles: true,
|
|
603
|
+
composed: true,
|
|
604
|
+
})
|
|
605
|
+
);
|
|
606
|
+
await editor.updateComplete;
|
|
607
|
+
expect(popover?.open).to.equal(false);
|
|
608
|
+
expect(editor.shadowRoot?.activeElement).to.equal(pencil);
|
|
609
|
+
|
|
610
|
+
pencil.click();
|
|
611
|
+
await editor.updateComplete;
|
|
612
|
+
const planned = plans.length;
|
|
613
|
+
(await laterTime()).click();
|
|
614
|
+
await editor.updateComplete;
|
|
615
|
+
expect(popover?.open).to.equal(false);
|
|
616
|
+
expect(editor.shadowRoot?.activeElement).to.equal(pencil);
|
|
617
|
+
await waitFor(() => plans.length > planned);
|
|
618
|
+
// The first new stop's time leads the plan.
|
|
619
|
+
expect(plans[plans.length - 1].start_time).to.equal("10:45");
|
|
620
|
+
|
|
621
|
+
// With a panel open, another stop's pencil opens that stop's panel instead.
|
|
622
|
+
await waitFor(() => editor.canAddStop);
|
|
623
|
+
await addCedar(scheduler, editor);
|
|
624
|
+
const cedarPencil = await waitFor(
|
|
625
|
+
() =>
|
|
626
|
+
!editor.loading &&
|
|
627
|
+
inEditor<HTMLButtonElement>(`.edit-time[data-building-id="${CEDAR}"]`)
|
|
628
|
+
);
|
|
629
|
+
pencil.click();
|
|
630
|
+
await editor.updateComplete;
|
|
631
|
+
expect(popover?.open).to.equal(true);
|
|
632
|
+
cedarPencil.click();
|
|
633
|
+
await editor.updateComplete;
|
|
634
|
+
expect(popover?.open).to.equal(false);
|
|
635
|
+
expect(
|
|
636
|
+
cedarPencil.closest<HTMLElement & { open: boolean }>("scheduler-popover")
|
|
637
|
+
?.open
|
|
638
|
+
).to.equal(true);
|
|
639
|
+
});
|
|
640
|
+
|
|
532
641
|
it("picks one community at a time: a pick replaces the community and opens its schedule", async () => {
|
|
533
642
|
fakeBackend();
|
|
534
643
|
const scheduler = mount();
|
|
@@ -840,7 +949,7 @@ it("carries bedrooms, move-in and budget between the picker's filters, the form
|
|
|
840
949
|
"#filter-bedrooms button"
|
|
841
950
|
) ?? []
|
|
842
951
|
)
|
|
843
|
-
.find((badge) => badge.textContent?.trim() === "2
|
|
952
|
+
.find((badge) => badge.textContent?.trim() === "2 bed")
|
|
844
953
|
?.click();
|
|
845
954
|
await picker.updateComplete;
|
|
846
955
|
await openFilter("moveIn");
|
|
@@ -986,20 +1095,7 @@ it("adds stops one at a time after a booking, offering each next stop after the
|
|
|
986
1095
|
const editor = await waitFor(() =>
|
|
987
1096
|
inScheduler<ItineraryEditor>(scheduler, "itinerary-editor")
|
|
988
1097
|
);
|
|
989
|
-
editor
|
|
990
|
-
const picker = await waitFor(() =>
|
|
991
|
-
inScheduler<CommunityPicker>(scheduler, ".add-stop-picker community-picker")
|
|
992
|
-
);
|
|
993
|
-
await picker.updateComplete;
|
|
994
|
-
const cedar = await waitFor(() =>
|
|
995
|
-
Array.from(
|
|
996
|
-
picker.shadowRoot?.querySelectorAll<HTMLButtonElement>(
|
|
997
|
-
"button.floorplan-image-card"
|
|
998
|
-
) ?? []
|
|
999
|
-
).find((card) => card.textContent?.includes("Cedar & Main"))
|
|
1000
|
-
);
|
|
1001
|
-
cedar.click();
|
|
1002
|
-
await waitFor(() => editor.stops.some((stop) => stop.building_id === CEDAR));
|
|
1098
|
+
await addCedar(scheduler, editor);
|
|
1003
1099
|
expect(inScheduler(scheduler, ".add-stop-picker")).to.equal(null);
|
|
1004
1100
|
|
|
1005
1101
|
// Its communities were asked for after The Linden, without either community.
|
|
@@ -1054,3 +1150,37 @@ it("closes the nearby list when the itinerary changes, and offers it again once
|
|
|
1054
1150
|
picker.shadowRoot?.querySelector("button.floorplan-image-card")
|
|
1055
1151
|
);
|
|
1056
1152
|
});
|
|
1153
|
+
|
|
1154
|
+
it("closes the date calendar when the prospect picks the day already chosen", async () => {
|
|
1155
|
+
fakeBackend();
|
|
1156
|
+
const scheduler = mount();
|
|
1157
|
+
const editor = await waitFor(() =>
|
|
1158
|
+
inScheduler<ItineraryEditor>(scheduler, "itinerary-editor")
|
|
1159
|
+
);
|
|
1160
|
+
const inEditor = <T extends Element>(selector: string) =>
|
|
1161
|
+
editor.shadowRoot?.querySelector<T>(selector) ?? null;
|
|
1162
|
+
const calendar = await waitFor(() =>
|
|
1163
|
+
inEditor<HTMLElement & { now: Date; requestUpdate: () => void }>(
|
|
1164
|
+
"date-picker"
|
|
1165
|
+
)
|
|
1166
|
+
);
|
|
1167
|
+
// The fake backend's tour day may have passed; the calendar only offers days from today on.
|
|
1168
|
+
calendar.now = new Date(2026, 9, 1);
|
|
1169
|
+
calendar.requestUpdate();
|
|
1170
|
+
const chosen = await waitFor(() =>
|
|
1171
|
+
calendar.shadowRoot?.querySelector<HTMLButtonElement>(
|
|
1172
|
+
"button.dayNumber.selected:not(:disabled)"
|
|
1173
|
+
)
|
|
1174
|
+
);
|
|
1175
|
+
const popover = await waitFor(() =>
|
|
1176
|
+
inEditor<HTMLElement & { open: boolean }>("scheduler-popover")
|
|
1177
|
+
);
|
|
1178
|
+
|
|
1179
|
+
inEditor<HTMLButtonElement>("#date-trigger")?.click();
|
|
1180
|
+
await editor.updateComplete;
|
|
1181
|
+
expect(popover.open).to.equal(true);
|
|
1182
|
+
|
|
1183
|
+
chosen.click();
|
|
1184
|
+
await editor.updateComplete;
|
|
1185
|
+
expect(popover.open).to.equal(false);
|
|
1186
|
+
});
|