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

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

initial commit

  • Property mode set to 100644
File size: 8.9 KB
Line 
1{"version":3,"file":"autocomplete__testing.js","sources":["../../../../../../src/material/autocomplete/testing/autocomplete-harness.ts","../../../../../../src/material/autocomplete/testing/autocomplete-harness-filters.ts","../../../../../../src/material/autocomplete/testing/public-api.ts","../../../../../../src/material/autocomplete/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 {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {\n BaseHarnessFilters,\n ComponentHarness,\n ComponentHarnessConstructor,\n HarnessPredicate,\n} from '@angular/cdk/testing';\nimport {\n MatOptgroupHarness,\n MatOptionHarness,\n OptgroupHarnessFilters,\n OptionHarnessFilters\n} from '@angular/material/core/testing';\nimport {AutocompleteHarnessFilters} from './autocomplete-harness-filters';\n\nexport abstract class _MatAutocompleteHarnessBase<\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 ComponentHarness {\n private _documentRootLocator = this.documentRootLocatorFactory();\n protected abstract _prefix: string;\n protected abstract _optionClass: OptionType;\n protected abstract _optionGroupClass: OptionGroupType;\n\n /** Gets the value of the autocomplete input. */\n async getValue(): Promise<string> {\n return (await this.host()).getProperty<string>('value');\n }\n\n /** Whether the autocomplete input is disabled. */\n async isDisabled(): Promise<boolean> {\n const disabled = (await this.host()).getAttribute('disabled');\n return coerceBooleanProperty(await disabled);\n }\n\n /** Focuses the autocomplete input. */\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n /** Blurs the autocomplete input. */\n async blur(): Promise<void> {\n return (await this.host()).blur();\n }\n\n /** Whether the autocomplete input is focused. */\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n\n /** Enters text into the autocomplete. */\n async enterText(value: string): Promise<void> {\n return (await this.host()).sendKeys(value);\n }\n\n /** Gets the options inside the autocomplete panel. */\n async getOptions(filters?: Omit<OptionFilters, 'ancestor'>): Promise<Option[]> {\n return this._documentRootLocator.locatorForAll(this._optionClass.with({\n ...(filters || {}),\n ancestor: await this._getPanelSelector()\n } as OptionFilters))();\n }\n\n /** Gets the option groups inside the autocomplete panel. */\n async getOptionGroups(filters?: Omit<OptionGroupFilters, 'ancestor'>): Promise<OptionGroup[]> {\n return this._documentRootLocator.locatorForAll(this._optionGroupClass.with({\n ...(filters || {}),\n ancestor: await this._getPanelSelector()\n } as OptionGroupFilters))();\n }\n\n /** Selects the first option matching the given filters. */\n async selectOption(filters: OptionFilters): Promise<void> {\n await this.focus(); // Focus the input to make sure the autocomplete panel is shown.\n const options = await this.getOptions(filters);\n if (!options.length) {\n throw Error(`Could not find a mat-option matching ${JSON.stringify(filters)}`);\n }\n await options[0].click();\n }\n\n /** Whether the autocomplete is open. */\n async isOpen(): Promise<boolean> {\n const panel = await this._getPanel();\n return !!panel && await panel.hasClass(`${this._prefix}-autocomplete-visible`);\n }\n\n /** Gets the panel associated with this autocomplete trigger. */\n private async _getPanel() {\n // Technically this is static, but it needs to be in a\n // function, because the autocomplete's panel ID can changed.\n return this._documentRootLocator.locatorForOptional(await this._getPanelSelector())();\n }\n\n /** Gets the selector that can be used to find the autocomplete trigger's panel. */\n private async _getPanelSelector(): Promise<string> {\n return `#${(await (await this.host()).getAttribute('aria-owns'))}`;\n }\n}\n\n/** Harness for interacting with a standard mat-autocomplete in tests. */\nexport class MatAutocompleteHarness extends _MatAutocompleteHarnessBase<\n typeof MatOptionHarness, MatOptionHarness, OptionHarnessFilters,\n typeof MatOptgroupHarness, MatOptgroupHarness, OptgroupHarnessFilters\n> {\n protected _prefix = 'mat';\n protected _optionClass = MatOptionHarness;\n protected _optionGroupClass = MatOptgroupHarness;\n\n /** The selector for the host element of a `MatAutocomplete` instance. */\n static hostSelector = '.mat-autocomplete-trigger';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatAutocompleteHarness` that meets\n * certain criteria.\n * @param options Options for filtering which autocomplete instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: AutocompleteHarnessFilters = {}): HarnessPredicate<MatAutocompleteHarness> {\n return new HarnessPredicate(MatAutocompleteHarness, options)\n .addOption('value', options.value,\n (harness, value) => HarnessPredicate.stringMatches(harness.getValue(), value));\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 `MatAutocompleteHarness` instances. */\nexport interface AutocompleteHarnessFilters extends BaseHarnessFilters {\n /** Only find instances whose associated input element matches the given value. */\n value?: 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 './autocomplete-harness';\nexport * from './autocomplete-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;;;;;;;MAuBsB,2BASpB,SAAQ,gBAAgB;IAT1B;;QAUU,yBAAoB,GAAG,IAAI,CAAC,0BAA0B,EAAE,CAAC;KA+ElE;;IAzEO,QAAQ;;YACZ,OAAO,CAAC,MAAM,IAAI,CAAC,I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