{"version":3,"file":"badge__testing.js","sources":["../../../../../../src/material/badge/testing/badge-harness.ts","../../../../../../src/material/badge/testing/badge-harness-filters.ts","../../../../../../src/material/badge/testing/public-api.ts","../../../../../../src/material/badge/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 {ComponentHarness, HarnessPredicate} from '@angular/cdk/testing';\nimport {MatBadgePosition, MatBadgeSize} from '@angular/material/badge';\nimport {BadgeHarnessFilters} from './badge-harness-filters';\n\n\n/** Harness for interacting with a standard Material badge in tests. */\nexport class MatBadgeHarness extends ComponentHarness {\n static hostSelector = '.mat-badge';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a badge with specific attributes.\n * @param options Options for narrowing the search:\n * - `text` finds a badge host with a particular text.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: BadgeHarnessFilters = {}): HarnessPredicate {\n return new HarnessPredicate(MatBadgeHarness, options)\n .addOption('text', options.text,\n (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text));\n }\n\n private _badgeElement = this.locatorFor('.mat-badge-content');\n\n /** Gets a promise for the badge text. */\n async getText(): Promise {\n return (await this._badgeElement()).text();\n }\n\n /** Gets whether the badge is overlapping the content. */\n async isOverlapping(): Promise {\n return (await this.host()).hasClass('mat-badge-overlap');\n }\n\n /** Gets the position of the badge. */\n async getPosition(): Promise {\n const host = await this.host();\n let result = '';\n\n if (await host.hasClass('mat-badge-above')) {\n result += 'above';\n } else if (await host.hasClass('mat-badge-below')) {\n result += 'below';\n }\n\n if (await host.hasClass('mat-badge-before')) {\n result += ' before';\n } else if (await host.hasClass('mat-badge-after')) {\n result += ' after';\n }\n\n return result.trim() as MatBadgePosition;\n }\n\n /** Gets the size of the badge. */\n async getSize(): Promise {\n const host = await this.host();\n\n if (await host.hasClass('mat-badge-small')) {\n return 'small';\n } else if (await host.hasClass('mat-badge-large')) {\n return 'large';\n }\n\n return 'medium';\n }\n\n /** Gets whether the badge is hidden. */\n async isHidden(): Promise {\n return (await this.host()).hasClass('mat-badge-hidden');\n }\n\n /** Gets whether the badge is disabled. */\n async isDisabled(): Promise {\n return (await this.host()).hasClass('mat-badge-disabled');\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\nexport interface BadgeHarnessFilters extends BaseHarnessFilters {\n text?: string | RegExp;\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\nexport * from './badge-harness';\nexport * from './badge-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;;;;;;;AAaA;MACa,eAAgB,SAAQ,gBAAgB;IAArD;;QAeU,kBAAa,GAAG,IAAI,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;KAsD/D;;;;;;;IA5DC,OAAO,IAAI,CAAC,UAA+B,EAAE;QAC3C,OAAO,IAAI,gBAAgB,CAAC,eAAe,EAAE,OAAO,CAAC;aAChD,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAC3B,CAAC,OAAO,EAAE,IAAI,KAAK,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;KACrF;;IAKK,OAAO;;YACX,OAAO,CAAC,MAAM,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,CAAC;SAC5C;KAAA;;IAGK,aAAa;;YACjB,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC,mBAAmB,CAA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