source: trip-planner-front/node_modules/@angular/material/fesm2015/slider/testing.js.map@ 84d0fbb

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

initial commit

  • Property mode set to 100644
File size: 8.4 KB
Line 
1{"version":3,"file":"slider__testing.js","sources":["../../../../../../src/material/slider/testing/slider-harness.ts","../../../../../../src/material/slider/testing/public-api.ts","../../../../../../src/material/slider/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, parallel} from '@angular/cdk/testing';\nimport {coerceBooleanProperty, coerceNumberProperty} from '@angular/cdk/coercion';\nimport {SliderHarnessFilters} from './slider-harness-filters';\n\n/** Harness for interacting with a standard mat-slider in tests. */\nexport class MatSliderHarness extends ComponentHarness {\n /** The selector for the host element of a `MatSlider` instance. */\n static hostSelector = '.mat-slider';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatSliderHarness` that meets\n * certain criteria.\n * @param options Options for filtering which slider instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: SliderHarnessFilters = {}): HarnessPredicate<MatSliderHarness> {\n return new HarnessPredicate(MatSliderHarness, options);\n }\n\n private _textLabel = this.locatorFor('.mat-slider-thumb-label-text');\n private _wrapper = this.locatorFor('.mat-slider-wrapper');\n\n /** Gets the slider's id. */\n async getId(): Promise<string|null> {\n const id = await (await this.host()).getAttribute('id');\n // In case no id has been specified, the \"id\" property always returns\n // an empty string. To make this method more explicit, we return null.\n return id !== '' ? id : null;\n }\n\n /**\n * Gets the current display value of the slider. Returns a null promise if the thumb label is\n * disabled.\n */\n async getDisplayValue(): Promise<string|null> {\n const [host, textLabel] = await parallel(() => [this.host(), this._textLabel()]);\n if (await host.hasClass('mat-slider-thumb-label-showing')) {\n return textLabel.text();\n }\n return null;\n }\n\n /** Gets the current percentage value of the slider. */\n async getPercentage(): Promise<number> {\n return this._calculatePercentage(await this.getValue());\n }\n\n /** Gets the current value of the slider. */\n async getValue(): Promise<number> {\n return coerceNumberProperty(await (await this.host()).getAttribute('aria-valuenow'));\n }\n\n /** Gets the maximum value of the slider. */\n async getMaxValue(): Promise<number> {\n return coerceNumberProperty(await (await this.host()).getAttribute('aria-valuemax'));\n }\n\n /** Gets the minimum value of the slider. */\n async getMinValue(): Promise<number> {\n return coerceNumberProperty(await (await this.host()).getAttribute('aria-valuemin'));\n }\n\n /** Whether the slider is disabled. */\n async isDisabled(): Promise<boolean> {\n const disabled = (await this.host()).getAttribute('aria-disabled');\n return coerceBooleanProperty(await disabled);\n }\n\n /** Gets the orientation of the slider. */\n async getOrientation(): Promise<'horizontal'|'vertical'> {\n // \"aria-orientation\" will always be set to either \"horizontal\" or \"vertical\".\n return (await this.host()).getAttribute('aria-orientation') as any;\n }\n\n /**\n * Sets the value of the slider by clicking on the slider track.\n *\n * Note that in rare cases the value cannot be set to the exact specified value. This\n * can happen if not every value of the slider maps to a single pixel that could be\n * clicked using mouse interaction. In such cases consider using the keyboard to\n * select the given value or expand the slider's size for a better user experience.\n */\n async setValue(value: number): Promise<void> {\n const [sliderEl, wrapperEl, orientation] =\n await parallel(() => [this.host(), this._wrapper(), this.getOrientation()]);\n let percentage = await this._calculatePercentage(value);\n const {height, width} = await wrapperEl.getDimensions();\n const isVertical = orientation === 'vertical';\n\n // In case the slider is inverted in LTR mode or not inverted in RTL mode,\n // we need to invert the percentage so that the proper value is set.\n if (await sliderEl.hasClass('mat-slider-invert-mouse-coords')) {\n percentage = 1 - percentage;\n }\n\n // We need to round the new coordinates because creating fake DOM\n // events will cause the coordinates to be rounded down.\n const relativeX = isVertical ? 0 : Math.round(width * percentage);\n const relativeY = isVertical ? Math.round(height * percentage) : 0;\n\n await wrapperEl.click(relativeX, relativeY);\n }\n\n /** Focuses the slider. */\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n /** Blurs the slider. */\n async blur(): Promise<void> {\n return (await this.host()).blur();\n }\n\n /** Whether the slider is focused. */\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n\n /** Calculates the percentage of the given value. */\n private async _calculatePercentage(value: number) {\n const [min, max] = await parallel(() => [this.getMinValue(), this.getMaxValue()]);\n return (value - min) / (max - min);\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 './slider-harness';\nexport * from './slider-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,gBAAiB,SAAQ,gBAAgB;IAAtD;;QAcU,eAAU,GAAG,IAAI,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC;QAC7D,aAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;KAuG3D;;;;;;;IA5GC,OAAO,IAAI,CAAC,UAAgC,EAAE;QAC5C,OAAO,IAAI,gBAAgB,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;KACxD;;IAMK,KAAK;;YACT,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;;;YAGxD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;SAC9B;KAAA;;;;;IAMK,eAAe;;YACnB,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;YACjF,IAAI,MAAM,IAAI,CAAC,QAAQ,CAAC,gCAAgC,CAAC,EAAE;gBACzD,OAAO,SAAS,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