[6a3a178] | 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 | */
|
---|
| 8 | import { ComponentHarness, LocatorFactory, TestElement } from '@angular/cdk/testing';
|
---|
| 9 | import { CalendarHarnessFilters } from './datepicker-harness-filters';
|
---|
| 10 | import { MatCalendarHarness } from './calendar-harness';
|
---|
| 11 | /** Interface for a test harness that can open and close a calendar. */
|
---|
| 12 | export interface DatepickerTrigger {
|
---|
| 13 | isCalendarOpen(): Promise<boolean>;
|
---|
| 14 | openCalendar(): Promise<void>;
|
---|
| 15 | closeCalendar(): Promise<void>;
|
---|
| 16 | hasCalendar(): Promise<boolean>;
|
---|
| 17 | getCalendar(filter?: CalendarHarnessFilters): Promise<MatCalendarHarness>;
|
---|
| 18 | }
|
---|
| 19 | /** Base class for harnesses that can trigger a calendar. */
|
---|
| 20 | export declare abstract class DatepickerTriggerHarnessBase extends ComponentHarness implements DatepickerTrigger {
|
---|
| 21 | /** Whether the trigger is disabled. */
|
---|
| 22 | abstract isDisabled(): Promise<boolean>;
|
---|
| 23 | /** Whether the calendar associated with the trigger is open. */
|
---|
| 24 | abstract isCalendarOpen(): Promise<boolean>;
|
---|
| 25 | /** Opens the calendar associated with the trigger. */
|
---|
| 26 | protected abstract _openCalendar(): Promise<void>;
|
---|
| 27 | /** Opens the calendar if the trigger is enabled and it has a calendar. */
|
---|
| 28 | openCalendar(): Promise<void>;
|
---|
| 29 | /** Closes the calendar if it is open. */
|
---|
| 30 | closeCalendar(): Promise<void>;
|
---|
| 31 | /** Gets whether there is a calendar associated with the trigger. */
|
---|
| 32 | hasCalendar(): Promise<boolean>;
|
---|
| 33 | /**
|
---|
| 34 | * Gets the `MatCalendarHarness` that is associated with the trigger.
|
---|
| 35 | * @param filter Optionally filters which calendar is included.
|
---|
| 36 | */
|
---|
| 37 | getCalendar(filter?: CalendarHarnessFilters): Promise<MatCalendarHarness>;
|
---|
| 38 | }
|
---|
| 39 | /** Gets the ID of the calendar that a particular test element can trigger. */
|
---|
| 40 | export declare function getCalendarId(host: Promise<TestElement>): Promise<string | null>;
|
---|
| 41 | /** Closes the calendar with a specific ID. */
|
---|
| 42 | export declare function closeCalendar(calendarId: Promise<string | null>, documentLocator: LocatorFactory): Promise<void>;
|
---|
| 43 | /** Gets the test harness for a calendar associated with a particular host. */
|
---|
| 44 | export declare function getCalendar(filter: CalendarHarnessFilters, host: Promise<TestElement>, documentLocator: LocatorFactory): Promise<MatCalendarHarness>;
|
---|