source: trip-planner-front/node_modules/@angular/material/fesm2015/select/testing.js.map@ b738035

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

initial commit

  • Property mode set to 100644
File size: 10.6 KB
Line 
1{"version":3,"file":"select__testing.js","sources":["../../../../../../src/material/select/testing/select-harness.ts","../../../../../../src/material/select/testing/select-harness-filters.ts","../../../../../../src/material/select/testing/public-api.ts","../../../../../../src/material/select/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 HarnessPredicate,\n parallel,\n ComponentHarness,\n BaseHarnessFilters,\n ComponentHarnessConstructor,\n} from '@angular/cdk/testing';\nimport {MatFormFieldControlHarness} from '@angular/material/form-field/testing/control';\nimport {\n MatOptionHarness,\n MatOptgroupHarness,\n OptionHarnessFilters,\n OptgroupHarnessFilters,\n} from '@angular/material/core/testing';\nimport {SelectHarnessFilters} from './select-harness-filters';\n\nexport abstract class _MatSelectHarnessBase<\n OptionType extends (ComponentHarnessConstructor<Option> & {\n with: (options?: OptionFilters) => HarnessPredicate<Option>}),\n Option extends ComponentHarness & {click(): Promise<void>},\n OptionFilters extends BaseHarnessFilters,\n OptionGroupType extends (ComponentHarnessConstructor<OptionGroup> & {\n with: (options?: OptionGroupFilters) => HarnessPredicate<OptionGroup>}),\n OptionGroup extends ComponentHarness,\n OptionGroupFilters extends BaseHarnessFilters\n> extends MatFormFieldControlHarness {\n protected abstract _prefix: string;\n protected abstract _optionClass: OptionType;\n protected abstract _optionGroupClass: OptionGroupType;\n private _documentRootLocator = this.documentRootLocatorFactory();\n private _backdrop = this._documentRootLocator.locatorFor('.cdk-overlay-backdrop');\n\n /** Gets a boolean promise indicating if the select is disabled. */\n async isDisabled(): Promise<boolean> {\n return (await this.host()).hasClass(`${this._prefix}-select-disabled`);\n }\n\n /** Gets a boolean promise indicating if the select is valid. */\n async isValid(): Promise<boolean> {\n return !(await (await this.host()).hasClass('ng-invalid'));\n }\n\n /** Gets a boolean promise indicating if the select is required. */\n async isRequired(): Promise<boolean> {\n return (await this.host()).hasClass(`${this._prefix}-select-required`);\n }\n\n /** Gets a boolean promise indicating if the select is empty (no value is selected). */\n async isEmpty(): Promise<boolean> {\n return (await this.host()).hasClass(`${this._prefix}-select-empty`);\n }\n\n /** Gets a boolean promise indicating if the select is in multi-selection mode. */\n async isMultiple(): Promise<boolean> {\n return (await this.host()).hasClass(`${this._prefix}-select-multiple`);\n }\n\n /** Gets a promise for the select's value text. */\n async getValueText(): Promise<string> {\n const value = await this.locatorFor(`.${this._prefix}-select-value`)();\n return value.text();\n }\n\n /** Focuses the select and returns a void promise that indicates when the action is complete. */\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n /** Blurs the select and returns a void promise that indicates when the action is complete. */\n async blur(): Promise<void> {\n return (await this.host()).blur();\n }\n\n /** Whether the select is focused. */\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n\n /** Gets the options inside the select panel. */\n async getOptions(filter?: Omit<OptionFilters, 'ancestor'>): Promise<Option[]> {\n return this._documentRootLocator.locatorForAll(this._optionClass.with({\n ...(filter || {}),\n ancestor: await this._getPanelSelector()\n } as OptionFilters))();\n }\n\n /** Gets the groups of options inside the panel. */\n async getOptionGroups(filter?: Omit<OptionGroupFilters, 'ancestor'>): Promise<OptionGroup[]> {\n return this._documentRootLocator.locatorForAll(this._optionGroupClass.with({\n ...(filter || {}),\n ancestor: await this._getPanelSelector()\n } as OptionGroupFilters))() as Promise<OptionGroup[]>;\n }\n\n /** Gets whether the select is open. */\n async isOpen(): Promise<boolean> {\n return !!await this._documentRootLocator.locatorForOptional(await this._getPanelSelector())();\n }\n\n /** Opens the select's panel. */\n async open(): Promise<void> {\n if (!await this.isOpen()) {\n const trigger = await this.locatorFor(`.${this._prefix}-select-trigger`)();\n return trigger.click();\n }\n }\n\n /**\n * Clicks the options that match the passed-in filter. If the select is in multi-selection\n * mode all options will be clicked, otherwise the harness will pick the first matching option.\n */\n async clickOptions(filter?: OptionFilters): Promise<void> {\n await this.open();\n\n const [isMultiple, options] =\n await parallel(() => [this.isMultiple(), this.getOptions(filter)]);\n\n if (options.length === 0) {\n throw Error('Select does not have options matching the specified filter');\n }\n\n if (isMultiple) {\n await parallel(() => options.map(option => option.click()));\n } else {\n await options[0].click();\n }\n }\n\n /** Closes the select's panel. */\n async close(): Promise<void> {\n if (await this.isOpen()) {\n // This is the most consistent way that works both in both single and multi-select modes,\n // but it assumes that only one overlay is open at a time. We should be able to make it\n // a bit more precise after #16645 where we can dispatch an ESCAPE press to the host instead.\n return (await this._backdrop()).click();\n }\n }\n\n /** Gets the selector that should be used to find this select's panel. */\n private async _getPanelSelector(): Promise<string> {\n const id = await (await this.host()).getAttribute('id');\n return `#${id}-panel`;\n }\n}\n\n/** Harness for interacting with a standard mat-select in tests. */\nexport class MatSelectHarness extends _MatSelectHarnessBase<\n typeof MatOptionHarness, MatOptionHarness, OptionHarnessFilters,\n typeof MatOptgroupHarness, MatOptgroupHarness, OptgroupHarnessFilters\n> {\n static hostSelector = '.mat-select';\n protected _prefix = 'mat';\n protected _optionClass = MatOptionHarness;\n protected _optionGroupClass = MatOptgroupHarness;\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatSelectHarness` that meets\n * certain criteria.\n * @param options Options for filtering which select instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: SelectHarnessFilters = {}): HarnessPredicate<MatSelectHarness> {\n return new HarnessPredicate(MatSelectHarness, 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 `MatSelectHarness` instances. */\nexport interface SelectHarnessFilters 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 './select-harness';\nexport * from './select-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;;;;;;;MAwBsB,qBASpB,SAAQ,0BAA0B;IATpC;;QAaU,yBAAoB,GAAG,IAAI,CAAC,0BAA0B,EAAE,CAAC;QACzD,cAAS,GAAG,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;KAiHnF;;IA9GO,UAAU;;YACd,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC,OAAO,kBAAkB,CAAC,CAAC;SACxE;KAAA;;IAGK,OAAO;;YACX,OAAO,EAAE,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;SAC5D;KAAA;;IAGK,UAAU;;YACd,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC,OAAO,kBAAkB,CAAC,CAAC;SACxE;KAAA;;IAGK,OAAO;;YACX,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC,OAAO,eAAe,CAAC,CAAC;SACrE;KAAA;;IAGK,UAAU;;YACd,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC,OAAO,kBAAkB,CAAC,CAAC;SACxE;KAAA;;IAGK,YAAY;;YAChB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,OAAO,eAAe,CAAC,EAAE,CAAC;YACvE,O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