UNPKG

7.52 kBSource Map (JSON)View Raw
1{"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/core/testing/option-harness.ts","../../../../../../../src/material/core/testing/optgroup-harness.ts","../../../../../../../src/material/core/testing/public-api.ts","../../../../../../../src/material/core/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 {OptionHarnessFilters} from './option-harness-filters';\n\n/** Harness for interacting with a `mat-option` in tests. */\nexport class MatOptionHarness extends ComponentHarness {\n /** Selector used to locate option instances. */\n static hostSelector = '.mat-option';\n\n /** Element containing the option's text. */\n private _text = this.locatorFor('.mat-option-text');\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatOptionsHarness` that meets\n * certain criteria.\n * @param options Options for filtering which option instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: OptionHarnessFilters = {}) {\n return new HarnessPredicate(MatOptionHarness, options)\n .addOption('text', options.text, async (harness, title) =>\n HarnessPredicate.stringMatches(await harness.getText(), title),\n )\n .addOption(\n 'isSelected',\n options.isSelected,\n async (harness, isSelected) => (await harness.isSelected()) === isSelected,\n );\n }\n\n /** Clicks the option. */\n async click(): Promise<void> {\n return (await this.host()).click();\n }\n\n /** Gets the option's label text. */\n async getText(): Promise<string> {\n return (await this._text()).text();\n }\n\n /** Gets whether the option is disabled. */\n async isDisabled(): Promise<boolean> {\n return (await this.host()).hasClass('mat-option-disabled');\n }\n\n /** Gets whether the option is selected. */\n async isSelected(): Promise<boolean> {\n return (await this.host()).hasClass('mat-selected');\n }\n\n /** Gets whether the option is active. */\n async isActive(): Promise<boolean> {\n return (await this.host()).hasClass('mat-active');\n }\n\n /** Gets whether the option is in multiple selection mode. */\n async isMultiple(): Promise<boolean> {\n return (await this.host()).hasClass('mat-option-multiple');\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 {ComponentHarness, HarnessPredicate} from '@angular/cdk/testing';\nimport {OptgroupHarnessFilters} from './optgroup-harness-filters';\nimport {MatOptionHarness} from './option-harness';\nimport {OptionHarnessFilters} from './option-harness-filters';\n\n/** Harness for interacting with a `mat-optgroup` in tests. */\nexport class MatOptgroupHarness extends ComponentHarness {\n /** Selector used to locate option group instances. */\n static hostSelector = '.mat-optgroup';\n private _label = this.locatorFor('.mat-optgroup-label');\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatOptgroupHarness` that meets\n * certain criteria.\n * @param options Options for filtering which option instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: OptgroupHarnessFilters = {}) {\n return new HarnessPredicate(MatOptgroupHarness, options).addOption(\n 'labelText',\n options.labelText,\n async (harness, title) => HarnessPredicate.stringMatches(await harness.getLabelText(), title),\n );\n }\n\n /** Gets the option group's label text. */\n async getLabelText(): Promise<string> {\n return (await this._label()).text();\n }\n\n /** Gets whether the option group is disabled. */\n async isDisabled(): Promise<boolean> {\n return (await this.host()).hasClass('mat-optgroup-disabled');\n }\n\n /**\n * Gets the options that are inside the group.\n * @param filter Optionally filters which options are included.\n */\n async getOptions(filter: OptionHarnessFilters = {}): Promise<MatOptionHarness[]> {\n return this.locatorForAll(MatOptionHarness.with(filter))();\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\nexport * from './option-harness';\nexport * from './option-harness-filters';\nexport * from './optgroup-harness';\nexport * from './optgroup-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":";;;AAWA;AACM,MAAO,gB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