source: trip-planner-front/node_modules/@angular/material/fesm2015/datepicker/testing.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 27.6 KB
Line 
1import { __awaiter } from 'tslib';
2import { HarnessPredicate, ComponentHarness, parallel, TestKey } from '@angular/cdk/testing';
3import { MatFormFieldControlHarness } from '@angular/material/form-field/testing/control';
4import { coerceBooleanProperty } from '@angular/cdk/coercion';
5
6/**
7 * @license
8 * Copyright Google LLC All Rights Reserved.
9 *
10 * Use of this source code is governed by an MIT-style license that can be
11 * found in the LICENSE file at https://angular.io/license
12 */
13
14/**
15 * @license
16 * Copyright Google LLC All Rights Reserved.
17 *
18 * Use of this source code is governed by an MIT-style license that can be
19 * found in the LICENSE file at https://angular.io/license
20 */
21/** Sets up the filter predicates for a datepicker input harness. */
22function getInputPredicate(type, options) {
23 return new HarnessPredicate(type, options)
24 .addOption('value', options.value, (harness, value) => {
25 return HarnessPredicate.stringMatches(harness.getValue(), value);
26 })
27 .addOption('placeholder', options.placeholder, (harness, placeholder) => {
28 return HarnessPredicate.stringMatches(harness.getPlaceholder(), placeholder);
29 });
30}
31/** Base class for datepicker input harnesses. */
32class MatDatepickerInputHarnessBase extends MatFormFieldControlHarness {
33 /** Whether the input is disabled. */
34 isDisabled() {
35 return __awaiter(this, void 0, void 0, function* () {
36 return (yield this.host()).getProperty('disabled');
37 });
38 }
39 /** Whether the input is required. */
40 isRequired() {
41 return __awaiter(this, void 0, void 0, function* () {
42 return (yield this.host()).getProperty('required');
43 });
44 }
45 /** Gets the value of the input. */
46 getValue() {
47 return __awaiter(this, void 0, void 0, function* () {
48 // The "value" property of the native input is always defined.
49 return (yield (yield this.host()).getProperty('value'));
50 });
51 }
52 /**
53 * Sets the value of the input. The value will be set by simulating
54 * keypresses that correspond to the given value.
55 */
56 setValue(newValue) {
57 return __awaiter(this, void 0, void 0, function* () {
58 const inputEl = yield this.host();
59 yield inputEl.clear();
60 // We don't want to send keys for the value if the value is an empty
61 // string in order to clear the value. Sending keys with an empty string
62 // still results in unnecessary focus events.
63 if (newValue) {
64 yield inputEl.sendKeys(newValue);
65 }
66 yield inputEl.dispatchEvent('change');
67 });
68 }
69 /** Gets the placeholder of the input. */
70 getPlaceholder() {
71 return __awaiter(this, void 0, void 0, function* () {
72 return (yield (yield this.host()).getProperty('placeholder'));
73 });
74 }
75 /**
76 * Focuses the input and returns a promise that indicates when the
77 * action is complete.
78 */
79 focus() {
80 return __awaiter(this, void 0, void 0, function* () {
81 return (yield this.host()).focus();
82 });
83 }
84 /**
85 * Blurs the input and returns a promise that indicates when the
86 * action is complete.
87 */
88 blur() {
89 return __awaiter(this, void 0, void 0, function* () {
90 return (yield this.host()).blur();
91 });
92 }
93 /** Whether the input is focused. */
94 isFocused() {
95 return __awaiter(this, void 0, void 0, function* () {
96 return (yield this.host()).isFocused();
97 });
98 }
99 /** Gets the formatted minimum date for the input's value. */
100 getMin() {
101 return __awaiter(this, void 0, void 0, function* () {
102 return (yield this.host()).getAttribute('min');
103 });
104 }
105 /** Gets the formatted maximum date for the input's value. */
106 getMax() {
107 return __awaiter(this, void 0, void 0, function* () {
108 return (yield this.host()).getAttribute('max');
109 });
110 }
111}
112
113/**
114 * @license
115 * Copyright Google LLC All Rights Reserved.
116 *
117 * Use of this source code is governed by an MIT-style license that can be
118 * found in the LICENSE file at https://angular.io/license
119 */
120/** Harness for interacting with a standard Material calendar cell in tests. */
121class MatCalendarCellHarness extends ComponentHarness {
122 constructor() {
123 super(...arguments);
124 /** Reference to the inner content element inside the cell. */
125 this._content = this.locatorFor('.mat-calendar-body-cell-content');
126 }
127 /**
128 * Gets a `HarnessPredicate` that can be used to search for a `MatCalendarCellHarness`
129 * that meets certain criteria.
130 * @param options Options for filtering which cell instances are considered a match.
131 * @return a `HarnessPredicate` configured with the given options.
132 */
133 static with(options = {}) {
134 return new HarnessPredicate(MatCalendarCellHarness, options)
135 .addOption('text', options.text, (harness, text) => {
136 return HarnessPredicate.stringMatches(harness.getText(), text);
137 })
138 .addOption('selected', options.selected, (harness, selected) => __awaiter(this, void 0, void 0, function* () {
139 return (yield harness.isSelected()) === selected;
140 }))
141 .addOption('active', options.active, (harness, active) => __awaiter(this, void 0, void 0, function* () {
142 return (yield harness.isActive()) === active;
143 }))
144 .addOption('disabled', options.disabled, (harness, disabled) => __awaiter(this, void 0, void 0, function* () {
145 return (yield harness.isDisabled()) === disabled;
146 }))
147 .addOption('today', options.today, (harness, today) => __awaiter(this, void 0, void 0, function* () {
148 return (yield harness.isToday()) === today;
149 }))
150 .addOption('inRange', options.inRange, (harness, inRange) => __awaiter(this, void 0, void 0, function* () {
151 return (yield harness.isInRange()) === inRange;
152 }))
153 .addOption('inComparisonRange', options.inComparisonRange, (harness, inComparisonRange) => __awaiter(this, void 0, void 0, function* () {
154 return (yield harness.isInComparisonRange()) === inComparisonRange;
155 }))
156 .addOption('inPreviewRange', options.inPreviewRange, (harness, inPreviewRange) => __awaiter(this, void 0, void 0, function* () {
157 return (yield harness.isInPreviewRange()) === inPreviewRange;
158 }));
159 }
160 /** Gets the text of the calendar cell. */
161 getText() {
162 return __awaiter(this, void 0, void 0, function* () {
163 return (yield this._content()).text();
164 });
165 }
166 /** Gets the aria-label of the calendar cell. */
167 getAriaLabel() {
168 return __awaiter(this, void 0, void 0, function* () {
169 // We're guaranteed for the `aria-label` to be defined
170 // since this is a private element that we control.
171 return (yield this.host()).getAttribute('aria-label');
172 });
173 }
174 /** Whether the cell is selected. */
175 isSelected() {
176 return __awaiter(this, void 0, void 0, function* () {
177 const host = yield this.host();
178 return (yield host.getAttribute('aria-selected')) === 'true';
179 });
180 }
181 /** Whether the cell is disabled. */
182 isDisabled() {
183 return __awaiter(this, void 0, void 0, function* () {
184 return this._hasState('disabled');
185 });
186 }
187 /** Whether the cell is currently activated using keyboard navigation. */
188 isActive() {
189 return __awaiter(this, void 0, void 0, function* () {
190 return this._hasState('active');
191 });
192 }
193 /** Whether the cell represents today's date. */
194 isToday() {
195 return __awaiter(this, void 0, void 0, function* () {
196 return (yield this._content()).hasClass('mat-calendar-body-today');
197 });
198 }
199 /** Selects the calendar cell. Won't do anything if the cell is disabled. */
200 select() {
201 return __awaiter(this, void 0, void 0, function* () {
202 return (yield this.host()).click();
203 });
204 }
205 /** Hovers over the calendar cell. */
206 hover() {
207 return __awaiter(this, void 0, void 0, function* () {
208 return (yield this.host()).hover();
209 });
210 }
211 /** Moves the mouse away from the calendar cell. */
212 mouseAway() {
213 return __awaiter(this, void 0, void 0, function* () {
214 return (yield this.host()).mouseAway();
215 });
216 }
217 /** Focuses the calendar cell. */
218 focus() {
219 return __awaiter(this, void 0, void 0, function* () {
220 return (yield this.host()).focus();
221 });
222 }
223 /** Removes focus from the calendar cell. */
224 blur() {
225 return __awaiter(this, void 0, void 0, function* () {
226 return (yield this.host()).blur();
227 });
228 }
229 /** Whether the cell is the start of the main range. */
230 isRangeStart() {
231 return __awaiter(this, void 0, void 0, function* () {
232 return this._hasState('range-start');
233 });
234 }
235 /** Whether the cell is the end of the main range. */
236 isRangeEnd() {
237 return __awaiter(this, void 0, void 0, function* () {
238 return this._hasState('range-end');
239 });
240 }
241 /** Whether the cell is part of the main range. */
242 isInRange() {
243 return __awaiter(this, void 0, void 0, function* () {
244 return this._hasState('in-range');
245 });
246 }
247 /** Whether the cell is the start of the comparison range. */
248 isComparisonRangeStart() {
249 return __awaiter(this, void 0, void 0, function* () {
250 return this._hasState('comparison-start');
251 });
252 }
253 /** Whether the cell is the end of the comparison range. */
254 isComparisonRangeEnd() {
255 return __awaiter(this, void 0, void 0, function* () {
256 return this._hasState('comparison-end');
257 });
258 }
259 /** Whether the cell is inside of the comparison range. */
260 isInComparisonRange() {
261 return __awaiter(this, void 0, void 0, function* () {
262 return this._hasState('in-comparison-range');
263 });
264 }
265 /** Whether the cell is the start of the preview range. */
266 isPreviewRangeStart() {
267 return __awaiter(this, void 0, void 0, function* () {
268 return this._hasState('preview-start');
269 });
270 }
271 /** Whether the cell is the end of the preview range. */
272 isPreviewRangeEnd() {
273 return __awaiter(this, void 0, void 0, function* () {
274 return this._hasState('preview-end');
275 });
276 }
277 /** Whether the cell is inside of the preview range. */
278 isInPreviewRange() {
279 return __awaiter(this, void 0, void 0, function* () {
280 return this._hasState('in-preview');
281 });
282 }
283 /** Returns whether the cell has a particular CSS class-based state. */
284 _hasState(name) {
285 return __awaiter(this, void 0, void 0, function* () {
286 return (yield this.host()).hasClass(`mat-calendar-body-${name}`);
287 });
288 }
289}
290MatCalendarCellHarness.hostSelector = '.mat-calendar-body-cell';
291
292/**
293 * @license
294 * Copyright Google LLC All Rights Reserved.
295 *
296 * Use of this source code is governed by an MIT-style license that can be
297 * found in the LICENSE file at https://angular.io/license
298 */
299/** Harness for interacting with a standard Material calendar in tests. */
300class MatCalendarHarness extends ComponentHarness {
301 constructor() {
302 super(...arguments);
303 /** Queries for the calendar's period toggle button. */
304 this._periodButton = this.locatorFor('.mat-calendar-period-button');
305 }
306 /**
307 * Gets a `HarnessPredicate` that can be used to search for a `MatCalendarHarness`
308 * that meets certain criteria.
309 * @param options Options for filtering which calendar instances are considered a match.
310 * @return a `HarnessPredicate` configured with the given options.
311 */
312 static with(options = {}) {
313 return new HarnessPredicate(MatCalendarHarness, options);
314 }
315 /**
316 * Gets a list of cells inside the calendar.
317 * @param filter Optionally filters which cells are included.
318 */
319 getCells(filter = {}) {
320 return __awaiter(this, void 0, void 0, function* () {
321 return this.locatorForAll(MatCalendarCellHarness.with(filter))();
322 });
323 }
324 /** Gets the current view that is being shown inside the calendar. */
325 getCurrentView() {
326 return __awaiter(this, void 0, void 0, function* () {
327 if (yield this.locatorForOptional('mat-multi-year-view')()) {
328 return 2 /* MULTI_YEAR */;
329 }
330 if (yield this.locatorForOptional('mat-year-view')()) {
331 return 1 /* YEAR */;
332 }
333 return 0 /* MONTH */;
334 });
335 }
336 /** Gets the label of the current calendar view. */
337 getCurrentViewLabel() {
338 return __awaiter(this, void 0, void 0, function* () {
339 return (yield this._periodButton()).text();
340 });
341 }
342 /** Changes the calendar view by clicking on the view toggle button. */
343 changeView() {
344 return __awaiter(this, void 0, void 0, function* () {
345 return (yield this._periodButton()).click();
346 });
347 }
348 /** Goes to the next page of the current view (e.g. next month when inside the month view). */
349 next() {
350 return __awaiter(this, void 0, void 0, function* () {
351 return (yield this.locatorFor('.mat-calendar-next-button')()).click();
352 });
353 }
354 /**
355 * Goes to the previous page of the current view
356 * (e.g. previous month when inside the month view).
357 */
358 previous() {
359 return __awaiter(this, void 0, void 0, function* () {
360 return (yield this.locatorFor('.mat-calendar-previous-button')()).click();
361 });
362 }
363 /**
364 * Selects a cell in the current calendar view.
365 * @param filter An optional filter to apply to the cells. The first cell matching the filter
366 * will be selected.
367 */
368 selectCell(filter = {}) {
369 return __awaiter(this, void 0, void 0, function* () {
370 const cells = yield this.getCells(filter);
371 if (!cells.length) {
372 throw Error(`Cannot find calendar cell matching filter ${JSON.stringify(filter)}`);
373 }
374 yield cells[0].select();
375 });
376 }
377}
378MatCalendarHarness.hostSelector = '.mat-calendar';
379
380/**
381 * @license
382 * Copyright Google LLC All Rights Reserved.
383 *
384 * Use of this source code is governed by an MIT-style license that can be
385 * found in the LICENSE file at https://angular.io/license
386 */
387/** Base class for harnesses that can trigger a calendar. */
388class DatepickerTriggerHarnessBase extends ComponentHarness {
389 /** Opens the calendar if the trigger is enabled and it has a calendar. */
390 openCalendar() {
391 return __awaiter(this, void 0, void 0, function* () {
392 const [isDisabled, hasCalendar] = yield parallel(() => [this.isDisabled(), this.hasCalendar()]);
393 if (!isDisabled && hasCalendar) {
394 return this._openCalendar();
395 }
396 });
397 }
398 /** Closes the calendar if it is open. */
399 closeCalendar() {
400 return __awaiter(this, void 0, void 0, function* () {
401 if (yield this.isCalendarOpen()) {
402 yield closeCalendar(getCalendarId(this.host()), this.documentRootLocatorFactory());
403 // This is necessary so that we wait for the closing animation to finish in touch UI mode.
404 yield this.forceStabilize();
405 }
406 });
407 }
408 /** Gets whether there is a calendar associated with the trigger. */
409 hasCalendar() {
410 return __awaiter(this, void 0, void 0, function* () {
411 return (yield getCalendarId(this.host())) != null;
412 });
413 }
414 /**
415 * Gets the `MatCalendarHarness` that is associated with the trigger.
416 * @param filter Optionally filters which calendar is included.
417 */
418 getCalendar(filter = {}) {
419 return __awaiter(this, void 0, void 0, function* () {
420 return getCalendar(filter, this.host(), this.documentRootLocatorFactory());
421 });
422 }
423}
424/** Gets the ID of the calendar that a particular test element can trigger. */
425function getCalendarId(host) {
426 return __awaiter(this, void 0, void 0, function* () {
427 return (yield host).getAttribute('data-mat-calendar');
428 });
429}
430/** Closes the calendar with a specific ID. */
431function closeCalendar(calendarId, documentLocator) {
432 return __awaiter(this, void 0, void 0, function* () {
433 // We close the calendar by clicking on the backdrop, even though all datepicker variants
434 // have the ability to close by pressing escape. The backdrop is preferrable, because the
435 // escape key has multiple functions inside a range picker (either cancel the current range
436 // or close the calendar). Since we don't have access to set the ID on the backdrop in all
437 // cases, we set a unique class instead which is the same as the calendar's ID and suffixed
438 // with `-backdrop`.
439 const backdropSelector = `.${yield calendarId}-backdrop`;
440 return (yield documentLocator.locatorFor(backdropSelector)()).click();
441 });
442}
443/** Gets the test harness for a calendar associated with a particular host. */
444function getCalendar(filter, host, documentLocator) {
445 return __awaiter(this, void 0, void 0, function* () {
446 const calendarId = yield getCalendarId(host);
447 if (!calendarId) {
448 throw Error(`Element is not associated with a calendar`);
449 }
450 return documentLocator.locatorFor(MatCalendarHarness.with(Object.assign(Object.assign({}, filter), { selector: `#${calendarId}` })))();
451 });
452}
453
454/**
455 * @license
456 * Copyright Google LLC All Rights Reserved.
457 *
458 * Use of this source code is governed by an MIT-style license that can be
459 * found in the LICENSE file at https://angular.io/license
460 */
461/** Harness for interacting with a standard Material datepicker inputs in tests. */
462class MatDatepickerInputHarness extends MatDatepickerInputHarnessBase {
463 /**
464 * Gets a `HarnessPredicate` that can be used to search for a `MatDatepickerInputHarness`
465 * that meets certain criteria.
466 * @param options Options for filtering which input instances are considered a match.
467 * @return a `HarnessPredicate` configured with the given options.
468 */
469 static with(options = {}) {
470 return getInputPredicate(MatDatepickerInputHarness, options);
471 }
472 /** Gets whether the calendar associated with the input is open. */
473 isCalendarOpen() {
474 return __awaiter(this, void 0, void 0, function* () {
475 // `aria-owns` is set only if there's an open datepicker so we can use it as an indicator.
476 const host = yield this.host();
477 return (yield host.getAttribute('aria-owns')) != null;
478 });
479 }
480 /** Opens the calendar associated with the input. */
481 openCalendar() {
482 return __awaiter(this, void 0, void 0, function* () {
483 const [isDisabled, hasCalendar] = yield parallel(() => [this.isDisabled(), this.hasCalendar()]);
484 if (!isDisabled && hasCalendar) {
485 // Alt + down arrow is the combination for opening the calendar with the keyboard.
486 const host = yield this.host();
487 return host.sendKeys({ alt: true }, TestKey.DOWN_ARROW);
488 }
489 });
490 }
491 /** Closes the calendar associated with the input. */
492 closeCalendar() {
493 return __awaiter(this, void 0, void 0, function* () {
494 if (yield this.isCalendarOpen()) {
495 yield closeCalendar(getCalendarId(this.host()), this.documentRootLocatorFactory());
496 // This is necessary so that we wait for the closing animation to finish in touch UI mode.
497 yield this.forceStabilize();
498 }
499 });
500 }
501 /** Whether a calendar is associated with the input. */
502 hasCalendar() {
503 return __awaiter(this, void 0, void 0, function* () {
504 return (yield getCalendarId(this.host())) != null;
505 });
506 }
507 /**
508 * Gets the `MatCalendarHarness` that is associated with the trigger.
509 * @param filter Optionally filters which calendar is included.
510 */
511 getCalendar(filter = {}) {
512 return __awaiter(this, void 0, void 0, function* () {
513 return getCalendar(filter, this.host(), this.documentRootLocatorFactory());
514 });
515 }
516}
517MatDatepickerInputHarness.hostSelector = '.mat-datepicker-input';
518
519/**
520 * @license
521 * Copyright Google LLC All Rights Reserved.
522 *
523 * Use of this source code is governed by an MIT-style license that can be
524 * found in the LICENSE file at https://angular.io/license
525 */
526/** Harness for interacting with a standard Material datepicker toggle in tests. */
527class MatDatepickerToggleHarness extends DatepickerTriggerHarnessBase {
528 constructor() {
529 super(...arguments);
530 /** The clickable button inside the toggle. */
531 this._button = this.locatorFor('button');
532 }
533 /**
534 * Gets a `HarnessPredicate` that can be used to search for a `MatDatepickerToggleHarness` that
535 * meets certain criteria.
536 * @param options Options for filtering which datepicker toggle instances are considered a match.
537 * @return a `HarnessPredicate` configured with the given options.
538 */
539 static with(options = {}) {
540 return new HarnessPredicate(MatDatepickerToggleHarness, options);
541 }
542 /** Gets whether the calendar associated with the toggle is open. */
543 isCalendarOpen() {
544 return __awaiter(this, void 0, void 0, function* () {
545 return (yield this.host()).hasClass('mat-datepicker-toggle-active');
546 });
547 }
548 /** Whether the toggle is disabled. */
549 isDisabled() {
550 return __awaiter(this, void 0, void 0, function* () {
551 const button = yield this._button();
552 return coerceBooleanProperty(yield button.getAttribute('disabled'));
553 });
554 }
555 _openCalendar() {
556 return __awaiter(this, void 0, void 0, function* () {
557 return (yield this._button()).click();
558 });
559 }
560}
561MatDatepickerToggleHarness.hostSelector = '.mat-datepicker-toggle';
562
563/**
564 * @license
565 * Copyright Google LLC All Rights Reserved.
566 *
567 * Use of this source code is governed by an MIT-style license that can be
568 * found in the LICENSE file at https://angular.io/license
569 */
570/** Harness for interacting with a standard Material date range start input in tests. */
571class MatStartDateHarness extends MatDatepickerInputHarnessBase {
572 /**
573 * Gets a `HarnessPredicate` that can be used to search for a `MatStartDateHarness`
574 * that meets certain criteria.
575 * @param options Options for filtering which input instances are considered a match.
576 * @return a `HarnessPredicate` configured with the given options.
577 */
578 static with(options = {}) {
579 return getInputPredicate(MatStartDateHarness, options);
580 }
581}
582MatStartDateHarness.hostSelector = '.mat-start-date';
583/** Harness for interacting with a standard Material date range end input in tests. */
584class MatEndDateHarness extends MatDatepickerInputHarnessBase {
585 /**
586 * Gets a `HarnessPredicate` that can be used to search for a `MatEndDateHarness`
587 * that meets certain criteria.
588 * @param options Options for filtering which input instances are considered a match.
589 * @return a `HarnessPredicate` configured with the given options.
590 */
591 static with(options = {}) {
592 return getInputPredicate(MatEndDateHarness, options);
593 }
594}
595MatEndDateHarness.hostSelector = '.mat-end-date';
596/** Harness for interacting with a standard Material date range input in tests. */
597class MatDateRangeInputHarness extends DatepickerTriggerHarnessBase {
598 /**
599 * Gets a `HarnessPredicate` that can be used to search for a `MatDateRangeInputHarness`
600 * that meets certain criteria.
601 * @param options Options for filtering which input instances are considered a match.
602 * @return a `HarnessPredicate` configured with the given options.
603 */
604 static with(options = {}) {
605 return new HarnessPredicate(MatDateRangeInputHarness, options)
606 .addOption('value', options.value, (harness, value) => HarnessPredicate.stringMatches(harness.getValue(), value));
607 }
608 /** Gets the combined value of the start and end inputs, including the separator. */
609 getValue() {
610 return __awaiter(this, void 0, void 0, function* () {
611 const [start, end, separator] = yield parallel(() => [
612 this.getStartInput().then(input => input.getValue()),
613 this.getEndInput().then(input => input.getValue()),
614 this.getSeparator()
615 ]);
616 return start + `${end ? ` ${separator} ${end}` : ''}`;
617 });
618 }
619 /** Gets the inner start date input inside the range input. */
620 getStartInput() {
621 return __awaiter(this, void 0, void 0, function* () {
622 // Don't pass in filters here since the start input is required and there can only be one.
623 return this.locatorFor(MatStartDateHarness)();
624 });
625 }
626 /** Gets the inner start date input inside the range input. */
627 getEndInput() {
628 return __awaiter(this, void 0, void 0, function* () {
629 // Don't pass in filters here since the end input is required and there can only be one.
630 return this.locatorFor(MatEndDateHarness)();
631 });
632 }
633 /** Gets the separator text between the values of the two inputs. */
634 getSeparator() {
635 return __awaiter(this, void 0, void 0, function* () {
636 return (yield this.locatorFor('.mat-date-range-input-separator')()).text();
637 });
638 }
639 /** Gets whether the range input is disabled. */
640 isDisabled() {
641 return __awaiter(this, void 0, void 0, function* () {
642 // We consider the input as disabled if both of the sub-inputs are disabled.
643 const [startDisabled, endDisabled] = yield parallel(() => [
644 this.getStartInput().then(input => input.isDisabled()),
645 this.getEndInput().then(input => input.isDisabled())
646 ]);
647 return startDisabled && endDisabled;
648 });
649 }
650 /** Gets whether the range input is required. */
651 isRequired() {
652 return __awaiter(this, void 0, void 0, function* () {
653 return (yield this.host()).hasClass('mat-date-range-input-required');
654 });
655 }
656 /** Opens the calendar associated with the input. */
657 isCalendarOpen() {
658 return __awaiter(this, void 0, void 0, function* () {
659 // `aria-owns` is set on both inputs only if there's an
660 // open range picker so we can use it as an indicator.
661 const startHost = yield (yield this.getStartInput()).host();
662 return (yield startHost.getAttribute('aria-owns')) != null;
663 });
664 }
665 _openCalendar() {
666 return __awaiter(this, void 0, void 0, function* () {
667 // Alt + down arrow is the combination for opening the calendar with the keyboard.
668 const startHost = yield (yield this.getStartInput()).host();
669 return startHost.sendKeys({ alt: true }, TestKey.DOWN_ARROW);
670 });
671 }
672}
673MatDateRangeInputHarness.hostSelector = '.mat-date-range-input';
674
675/**
676 * @license
677 * Copyright Google LLC All Rights Reserved.
678 *
679 * Use of this source code is governed by an MIT-style license that can be
680 * found in the LICENSE file at https://angular.io/license
681 */
682
683/**
684 * @license
685 * Copyright Google LLC All Rights Reserved.
686 *
687 * Use of this source code is governed by an MIT-style license that can be
688 * found in the LICENSE file at https://angular.io/license
689 */
690
691export { MatCalendarCellHarness, MatCalendarHarness, MatDateRangeInputHarness, MatDatepickerInputHarness, MatDatepickerToggleHarness, MatEndDateHarness, MatStartDateHarness };
692//# sourceMappingURL=testing.js.map
Note: See TracBrowser for help on using the repository browser.