source: trip-planner-front/node_modules/@angular/material/esm2015/datepicker/testing/date-range-input-harness.js@ 6fe77af

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

initial commit

  • Property mode set to 100644
File size: 15.7 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { __awaiter } from "tslib";
9import { HarnessPredicate, parallel, TestKey } from '@angular/cdk/testing';
10import { MatDatepickerInputHarnessBase, getInputPredicate } from './datepicker-input-harness-base';
11import { DatepickerTriggerHarnessBase } from './datepicker-trigger-harness-base';
12/** Harness for interacting with a standard Material date range start input in tests. */
13export class MatStartDateHarness extends MatDatepickerInputHarnessBase {
14 /**
15 * Gets a `HarnessPredicate` that can be used to search for a `MatStartDateHarness`
16 * that meets certain criteria.
17 * @param options Options for filtering which input instances are considered a match.
18 * @return a `HarnessPredicate` configured with the given options.
19 */
20 static with(options = {}) {
21 return getInputPredicate(MatStartDateHarness, options);
22 }
23}
24MatStartDateHarness.hostSelector = '.mat-start-date';
25/** Harness for interacting with a standard Material date range end input in tests. */
26export class MatEndDateHarness extends MatDatepickerInputHarnessBase {
27 /**
28 * Gets a `HarnessPredicate` that can be used to search for a `MatEndDateHarness`
29 * that meets certain criteria.
30 * @param options Options for filtering which input instances are considered a match.
31 * @return a `HarnessPredicate` configured with the given options.
32 */
33 static with(options = {}) {
34 return getInputPredicate(MatEndDateHarness, options);
35 }
36}
37MatEndDateHarness.hostSelector = '.mat-end-date';
38/** Harness for interacting with a standard Material date range input in tests. */
39export class MatDateRangeInputHarness extends DatepickerTriggerHarnessBase {
40 /**
41 * Gets a `HarnessPredicate` that can be used to search for a `MatDateRangeInputHarness`
42 * that meets certain criteria.
43 * @param options Options for filtering which input instances are considered a match.
44 * @return a `HarnessPredicate` configured with the given options.
45 */
46 static with(options = {}) {
47 return new HarnessPredicate(MatDateRangeInputHarness, options)
48 .addOption('value', options.value, (harness, value) => HarnessPredicate.stringMatches(harness.getValue(), value));
49 }
50 /** Gets the combined value of the start and end inputs, including the separator. */
51 getValue() {
52 return __awaiter(this, void 0, void 0, function* () {
53 const [start, end, separator] = yield parallel(() => [
54 this.getStartInput().then(input => input.getValue()),
55 this.getEndInput().then(input => input.getValue()),
56 this.getSeparator()
57 ]);
58 return start + `${end ? ` ${separator} ${end}` : ''}`;
59 });
60 }
61 /** Gets the inner start date input inside the range input. */
62 getStartInput() {
63 return __awaiter(this, void 0, void 0, function* () {
64 // Don't pass in filters here since the start input is required and there can only be one.
65 return this.locatorFor(MatStartDateHarness)();
66 });
67 }
68 /** Gets the inner start date input inside the range input. */
69 getEndInput() {
70 return __awaiter(this, void 0, void 0, function* () {
71 // Don't pass in filters here since the end input is required and there can only be one.
72 return this.locatorFor(MatEndDateHarness)();
73 });
74 }
75 /** Gets the separator text between the values of the two inputs. */
76 getSeparator() {
77 return __awaiter(this, void 0, void 0, function* () {
78 return (yield this.locatorFor('.mat-date-range-input-separator')()).text();
79 });
80 }
81 /** Gets whether the range input is disabled. */
82 isDisabled() {
83 return __awaiter(this, void 0, void 0, function* () {
84 // We consider the input as disabled if both of the sub-inputs are disabled.
85 const [startDisabled, endDisabled] = yield parallel(() => [
86 this.getStartInput().then(input => input.isDisabled()),
87 this.getEndInput().then(input => input.isDisabled())
88 ]);
89 return startDisabled && endDisabled;
90 });
91 }
92 /** Gets whether the range input is required. */
93 isRequired() {
94 return __awaiter(this, void 0, void 0, function* () {
95 return (yield this.host()).hasClass('mat-date-range-input-required');
96 });
97 }
98 /** Opens the calendar associated with the input. */
99 isCalendarOpen() {
100 return __awaiter(this, void 0, void 0, function* () {
101 // `aria-owns` is set on both inputs only if there's an
102 // open range picker so we can use it as an indicator.
103 const startHost = yield (yield this.getStartInput()).host();
104 return (yield startHost.getAttribute('aria-owns')) != null;
105 });
106 }
107 _openCalendar() {
108 return __awaiter(this, void 0, void 0, function* () {
109 // Alt + down arrow is the combination for opening the calendar with the keyboard.
110 const startHost = yield (yield this.getStartInput()).host();
111 return startHost.sendKeys({ alt: true }, TestKey.DOWN_ARROW);
112 });
113 }
114}
115MatDateRangeInputHarness.hostSelector = '.mat-date-range-input';
116//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0ZS1yYW5nZS1pbnB1dC1oYXJuZXNzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL2RhdGVwaWNrZXIvdGVzdGluZy9kYXRlLXJhbmdlLWlucHV0LWhhcm5lc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HOztBQUVILE9BQU8sRUFBQyxnQkFBZ0IsRUFBRSxRQUFRLEVBQUUsT0FBTyxFQUFDLE1BQU0sc0JBQXNCLENBQUM7QUFDekUsT0FBTyxFQUFDLDZCQUE2QixFQUFFLGlCQUFpQixFQUFDLE1BQU0saUNBQWlDLENBQUM7QUFDakcsT0FBTyxFQUFDLDRCQUE0QixFQUFDLE1BQU0sbUNBQW1DLENBQUM7QUFNL0Usd0ZBQXdGO0FBQ3hGLE1BQU0sT0FBTyxtQkFBb0IsU0FBUSw2QkFBNkI7SUFHcEU7Ozs7O09BS0c7SUFDSCxNQUFNLENBQUMsSUFBSSxDQUFDLFVBQXlDLEVBQUU7UUFFckQsT0FBTyxpQkFBaUIsQ0FBQyxtQkFBbUIsRUFBRSxPQUFPLENBQUMsQ0FBQztJQUN6RCxDQUFDOztBQVhNLGdDQUFZLEdBQUcsaUJBQWlCLENBQUM7QUFjMUMsc0ZBQXNGO0FBQ3RGLE1BQU0sT0FBTyxpQkFBa0IsU0FBUSw2QkFBNkI7SUFHbEU7Ozs7O09BS0c7SUFDSCxNQUFNLENBQUMsSUFBSSxDQUFDLFVBQXlDLEVBQUU7UUFFckQsT0FBTyxpQkFBaUIsQ0FBQyx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