1 | {"version":3,"file":"tooltip__testing.js","sources":["../../../../../../src/material/tooltip/testing/tooltip-harness.ts","../../../../../../src/material/tooltip/testing/tooltip-harness-filters.ts","../../../../../../src/material/tooltip/testing/public-api.ts","../../../../../../src/material/tooltip/testing/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n AsyncFactoryFn,\n ComponentHarness,\n HarnessPredicate,\n TestElement,\n} from '@angular/cdk/testing';\nimport {TooltipHarnessFilters} from './tooltip-harness-filters';\n\nexport abstract class _MatTooltipHarnessBase extends ComponentHarness {\n protected abstract _optionalPanel: AsyncFactoryFn<TestElement | null>;\n\n /** Shows the tooltip. */\n async show(): Promise<void> {\n const host = await this.host();\n\n // We need to dispatch both `touchstart` and a hover event, because the tooltip binds\n // different events depending on the device. The `changedTouches` is there in case the\n // element has ripples.\n // @breaking-change 12.0.0 Remove null assertion from `dispatchEvent`.\n await host.dispatchEvent?.('touchstart', {changedTouches: []});\n await host.hover();\n }\n\n /** Hides the tooltip. */\n async hide(): Promise<void> {\n const host = await this.host();\n\n // We need to dispatch both `touchstart` and a hover event, because\n // the tooltip binds different events depending on the device.\n // @breaking-change 12.0.0 Remove null assertion from `dispatchEvent`.\n await host.dispatchEvent?.('touchend');\n await host.mouseAway();\n await this.forceStabilize(); // Needed in order to flush the `hide` animation.\n }\n\n /** Gets whether the tooltip is open. */\n async isOpen(): Promise<boolean> {\n return !!(await this._optionalPanel());\n }\n\n /** Gets a promise for the tooltip panel's text. */\n async getTooltipText(): Promise<string> {\n const panel = await this._optionalPanel();\n return panel ? panel.text() : '';\n }\n}\n\n/** Harness for interacting with a standard mat-tooltip in tests. */\nexport class MatTooltipHarness extends _MatTooltipHarnessBase {\n protected _optionalPanel = this.documentRootLocatorFactory().locatorForOptional('.mat-tooltip');\n static hostSelector = '.mat-tooltip-trigger';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search\n * for a tooltip trigger with specific attributes.\n * @param options Options for narrowing the search.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: TooltipHarnessFilters = {}): HarnessPredicate<MatTooltipHarness> {\n return new HarnessPredicate(MatTooltipHarness, options);\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {BaseHarnessFilters} from '@angular/cdk/testing';\n\n/** A set of criteria that can be used to filter a list of `MatTooltipHarness` instances. */\nexport interface TooltipHarnessFilters extends BaseHarnessFilters {}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './tooltip-harness';\nexport * from './tooltip-harness-filters';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAAA;;;;;;;MAgBsB,sBAAuB,SAAQ,gBAAgB;;IAI7D,IAAI;;;YACR,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;;;;;YAM/B,OAAM,MAAA,IAAI,CAAC,aAAa,+CAAlB,IAAI,EAAiB,YAAY,EAAE,EAAC,cAAc,EAAE,EAAE,EAAC,CAAC,CAAA,CAAC;YAC/D,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;;KACpB;;IAGK,IAAI;;;YACR,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;;;;YAK/B,OAAM,MAAA,IAAI,CAAC,aAAa,+CAAlB,IAAI,EAAiB,UAAU,CAAC,CAAA,CAAC;YACvC,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;YACvB,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;;KAC7B;;IAGK,MAAM;;YACV,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;SACxC;KAAA;;IAGK,cAAc;;YAClB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAC1C,OAAO,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC;SAClC;KAAA;CACF;AAED;MACa,iBAAkB,SAAQ,sBAAsB;IAA7D;;QACY,mBAAc,GAAG,IAAI,CAAC,0BAA0B,EAAE,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;KAYjG;;;;;;;IAHC,OAAO,IAAI,CAAC,UAAiC,EAAE;QAC7C,OAAO,IAAI,gBAAgB,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;KACzD;;AAVM,8BAAY,GAAG,sBAAsB;;AC1D9C;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;;;"} |
---|