source: trip-planner-front/node_modules/@angular/material/fesm2015/snack-bar/testing.js.map@ 6c1585f

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

initial commit

  • Property mode set to 100644
File size: 8.2 KB
Line 
1{"version":3,"file":"snack-bar__testing.js","sources":["../../../../../../src/material/snack-bar/testing/snack-bar-harness.ts","../../../../../../src/material/snack-bar/testing/snack-bar-harness-filters.ts","../../../../../../src/material/snack-bar/testing/public-api.ts","../../../../../../src/material/snack-bar/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 {AriaLivePoliteness} from '@angular/cdk/a11y';\nimport {ContentContainerComponentHarness, HarnessPredicate, parallel} from '@angular/cdk/testing';\nimport {SnackBarHarnessFilters} from './snack-bar-harness-filters';\n\n/** Harness for interacting with a standard mat-snack-bar in tests. */\nexport class MatSnackBarHarness extends ContentContainerComponentHarness<string> {\n // Developers can provide a custom component or template for the\n // snackbar. The canonical snack-bar parent is the \"MatSnackBarContainer\".\n /** The selector for the host element of a `MatSnackBar` instance. */\n static hostSelector = '.mat-snack-bar-container';\n protected _messageSelector = '.mat-simple-snackbar > span';\n protected _actionButtonSelector = '.mat-simple-snackbar-action > button';\n private _snackBarLiveRegion = this.locatorFor('[aria-live]');\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatSnackBarHarness` that meets\n * certain criteria.\n * @param options Options for filtering which snack bar instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: SnackBarHarnessFilters = {}): HarnessPredicate<MatSnackBarHarness> {\n return new HarnessPredicate(MatSnackBarHarness, options);\n }\n\n /**\n * Gets the role of the snack-bar. The role of a snack-bar is determined based\n * on the ARIA politeness specified in the snack-bar config.\n * @deprecated Use `getAriaLive` instead.\n * @breaking-change 13.0.0\n */\n async getRole(): Promise<'alert'|'status'|null> {\n return (await this.host()).getAttribute('role') as Promise<'alert'|'status'|null>;\n }\n\n /**\n * Gets the aria-live of the snack-bar's live region. The aria-live of a snack-bar is\n * determined based on the ARIA politeness specified in the snack-bar config.\n */\n async getAriaLive(): Promise<AriaLivePoliteness> {\n return (await this._snackBarLiveRegion())\n .getAttribute('aria-live') as Promise<AriaLivePoliteness>;\n }\n\n /**\n * Whether the snack-bar has an action. Method cannot be used for snack-bar's with custom content.\n */\n async hasAction(): Promise<boolean> {\n await this._assertContentAnnotated();\n return (await this._getActionButton()) !== null;\n }\n\n /**\n * Gets the description of the snack-bar. Method cannot be used for snack-bar's without action or\n * with custom content.\n */\n async getActionDescription(): Promise<string> {\n await this._assertHasAction();\n return (await this._getActionButton())!.text();\n }\n\n\n /**\n * Dismisses the snack-bar by clicking the action button. Method cannot be used for snack-bar's\n * without action or with custom content.\n */\n async dismissWithAction(): Promise<void> {\n await this._assertHasAction();\n await (await this._getActionButton())!.click();\n }\n\n /**\n * Gets the message of the snack-bar. Method cannot be used for snack-bar's with custom content.\n */\n async getMessage(): Promise<string> {\n await this._assertContentAnnotated();\n return (await this.locatorFor(this._messageSelector)()).text();\n }\n\n /** Gets whether the snack-bar has been dismissed. */\n async isDismissed(): Promise<boolean> {\n // We consider the snackbar dismissed if it's not in the DOM. We can assert that the\n // element isn't in the DOM by seeing that its width and height are zero.\n\n const host = await this.host();\n const [exit, dimensions] = await parallel(() => [\n // The snackbar container is marked with the \"exit\" attribute after it has been dismissed\n // but before the animation has finished (after which it's removed from the DOM).\n host.getAttribute('mat-exit'),\n host.getDimensions(),\n ]);\n\n return exit != null || (!!dimensions && dimensions.height === 0 && dimensions.width === 0);\n }\n\n /**\n * Asserts that the current snack-bar has annotated content. Promise reject\n * if content is not annotated.\n */\n protected async _assertContentAnnotated(): Promise<void> {\n if (!await this._isSimpleSnackBar()) {\n throw Error('Method cannot be used for snack-bar with custom content.');\n }\n }\n\n /**\n * Asserts that the current snack-bar has an action defined. Otherwise the\n * promise will reject.\n */\n protected async _assertHasAction(): Promise<void> {\n await this._assertContentAnnotated();\n if (!await this.hasAction()) {\n throw Error('Method cannot be used for a snack-bar without an action.');\n }\n }\n\n /** Whether the snack-bar is using the default content template. */\n private async _isSimpleSnackBar(): Promise<boolean> {\n return await this.locatorForOptional('.mat-simple-snackbar')() !== null;\n }\n\n /** Gets the simple snack bar action button. */\n private async _getActionButton() {\n return this.locatorForOptional(this._actionButtonSelector)();\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 `MatSnackBarHarness` instances. */\nexport interface SnackBarHarnessFilters 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 './snack-bar-harness';\nexport * from './snack-bar-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;;;;;;;AAYA;MACa,kBAAmB,SAAQ,gCAAwC;IAAhF;;QAKY,qBAAgB,GAAG,6BAA6B,CAAC;QACjD,0BAAqB,GAAG,sCAAsC,CAAC;QACjE,wBAAmB,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;KAgH9D;;;;;;;IAxGC,OAAO,IAAI,CAAC,UAAkC,EAAE;QAC9C,OAAO,IAAI,gBAAgB,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;KAC1D;;;;;;;IAQK,OAAO;;YACX,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,YAAY,CAAC,MAAM,CAAmC,CAAC;SACnF;KAAA;;;;;IAMK,WAAW;;YACf,OAAO,CAAC,MA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