testing.mjs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { D as DatepickerTriggerHarnessBase } from '../date-range-input-harness-Bp1T4oUe.mjs';
  2. export { C as CalendarView, e as MatCalendarCellHarness, d as MatCalendarHarness, c as MatDateRangeInputHarness, M as MatDatepickerInputHarness, b as MatEndDateHarness, a as MatStartDateHarness } from '../date-range-input-harness-Bp1T4oUe.mjs';
  3. import { HarnessPredicate } from '@angular/cdk/testing';
  4. import { coerceBooleanProperty } from '@angular/cdk/coercion';
  5. import '../form-field/testing/control.mjs';
  6. /** Harness for interacting with a standard Material datepicker toggle in tests. */
  7. class MatDatepickerToggleHarness extends DatepickerTriggerHarnessBase {
  8. static hostSelector = '.mat-datepicker-toggle';
  9. /** The clickable button inside the toggle. */
  10. _button = this.locatorFor('button');
  11. /**
  12. * Gets a `HarnessPredicate` that can be used to search for a `MatDatepickerToggleHarness` that
  13. * meets certain criteria.
  14. * @param options Options for filtering which datepicker toggle instances are considered a match.
  15. * @return a `HarnessPredicate` configured with the given options.
  16. */
  17. static with(options = {}) {
  18. return new HarnessPredicate(MatDatepickerToggleHarness, options);
  19. }
  20. /** Gets whether the calendar associated with the toggle is open. */
  21. async isCalendarOpen() {
  22. return (await this.host()).hasClass('mat-datepicker-toggle-active');
  23. }
  24. /** Whether the toggle is disabled. */
  25. async isDisabled() {
  26. const button = await this._button();
  27. return coerceBooleanProperty(await button.getAttribute('disabled'));
  28. }
  29. async _openCalendar() {
  30. return (await this._button()).click();
  31. }
  32. }
  33. export { MatDatepickerToggleHarness };
  34. //# sourceMappingURL=testing.mjs.map