source: trip-planner-front/node_modules/@angular/material/esm2015/datepicker/testing/datepicker-toggle-harness.js@ e29cc2e

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

initial commit

  • Property mode set to 100644
File size: 5.6 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 } from '@angular/cdk/testing';
10import { coerceBooleanProperty } from '@angular/cdk/coercion';
11import { DatepickerTriggerHarnessBase } from './datepicker-trigger-harness-base';
12/** Harness for interacting with a standard Material datepicker toggle in tests. */
13export class MatDatepickerToggleHarness extends DatepickerTriggerHarnessBase {
14 constructor() {
15 super(...arguments);
16 /** The clickable button inside the toggle. */
17 this._button = this.locatorFor('button');
18 }
19 /**
20 * Gets a `HarnessPredicate` that can be used to search for a `MatDatepickerToggleHarness` that
21 * meets certain criteria.
22 * @param options Options for filtering which datepicker toggle instances are considered a match.
23 * @return a `HarnessPredicate` configured with the given options.
24 */
25 static with(options = {}) {
26 return new HarnessPredicate(MatDatepickerToggleHarness, options);
27 }
28 /** Gets whether the calendar associated with the toggle is open. */
29 isCalendarOpen() {
30 return __awaiter(this, void 0, void 0, function* () {
31 return (yield this.host()).hasClass('mat-datepicker-toggle-active');
32 });
33 }
34 /** Whether the toggle is disabled. */
35 isDisabled() {
36 return __awaiter(this, void 0, void 0, function* () {
37 const button = yield this._button();
38 return coerceBooleanProperty(yield button.getAttribute('disabled'));
39 });
40 }
41 _openCalendar() {
42 return __awaiter(this, void 0, void 0, function* () {
43 return (yield this._button()).click();
44 });
45 }
46}
47MatDatepickerToggleHarness.hostSelector = '.mat-datepicker-toggle';
48//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0ZXBpY2tlci10b2dnbGUtaGFybmVzcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3Vy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