diff --git a/src/cdk/testing/protractor/protractor-element.ts b/src/cdk/testing/protractor/protractor-element.ts index eba83f392098..515d5d64df27 100644 --- a/src/cdk/testing/protractor/protractor-element.ts +++ b/src/cdk/testing/protractor/protractor-element.ts @@ -206,7 +206,7 @@ export class ProtractorElement implements TestElement { } /** Gets the value of a property of an element. */ - async getProperty(name: string): Promise { + async getProperty(name: string): Promise { return browser.executeScript(`return arguments[0][arguments[1]]`, this.element, name); } diff --git a/src/cdk/testing/selenium-webdriver/selenium-web-driver-element.ts b/src/cdk/testing/selenium-webdriver/selenium-web-driver-element.ts index 23ce5c894592..2f7217ddf994 100644 --- a/src/cdk/testing/selenium-webdriver/selenium-web-driver-element.ts +++ b/src/cdk/testing/selenium-webdriver/selenium-web-driver-element.ts @@ -163,7 +163,7 @@ export class SeleniumWebDriverElement implements TestElement { } /** Gets the value of a property of an element. */ - async getProperty(name: string): Promise { + async getProperty(name: string): Promise { await this._stabilize(); return this._executeScript( (element: Element, property: keyof Element) => element[property], diff --git a/src/cdk/testing/test-element.ts b/src/cdk/testing/test-element.ts index 031ff4f3d513..664613697ce5 100644 --- a/src/cdk/testing/test-element.ts +++ b/src/cdk/testing/test-element.ts @@ -137,7 +137,7 @@ export interface TestElement { getDimensions(): Promise; /** Gets the value of a property of an element. */ - getProperty(name: string): Promise; + getProperty(name: string): Promise; /** Checks whether this element matches the given selector. */ matchesSelector(selector: string): Promise; diff --git a/src/cdk/testing/testbed/unit-test-element.ts b/src/cdk/testing/testbed/unit-test-element.ts index 22a393227de5..40f9b0d3fe64 100644 --- a/src/cdk/testing/testbed/unit-test-element.ts +++ b/src/cdk/testing/testbed/unit-test-element.ts @@ -191,7 +191,7 @@ export class UnitTestElement implements TestElement { } /** Gets the value of a property of an element. */ - async getProperty(name: string): Promise { + async getProperty(name: string): Promise { await this._stabilize(); return (this.element as any)[name]; } diff --git a/src/cdk/testing/tests/cross-environment.spec.ts b/src/cdk/testing/tests/cross-environment.spec.ts index fd94ed05d0f5..fb2cd1e19826 100644 --- a/src/cdk/testing/tests/cross-environment.spec.ts +++ b/src/cdk/testing/tests/cross-environment.spec.ts @@ -323,10 +323,10 @@ export function crossEnvironmentSpecs( it('should be able to clear', async () => { const input = await harness.input(); await input.sendKeys('Yi'); - expect(await input.getProperty('value')).toBe('Yi'); + expect(await input.getProperty('value')).toBe('Yi'); await input.clear(); - expect(await input.getProperty('value')).toBe(''); + expect(await input.getProperty('value')).toBe(''); }); it('should be able to click', async () => { @@ -401,7 +401,7 @@ export function crossEnvironmentSpecs( const value = await harness.value(); await input.sendKeys('Yi'); - expect(await input.getProperty('value')).toBe('Yi'); + expect(await input.getProperty('value')).toBe('Yi'); expect(await value.text()).toBe('Input: Yi'); }); @@ -416,7 +416,7 @@ export function crossEnvironmentSpecs( const value = await harness.numberInputValue(); await input.sendKeys('123.456'); - expect(await input.getProperty('value')).toBe('123.456'); + expect(await input.getProperty('value')).toBe('123.456'); expect(await value.text()).toBe('Number value: 123.456'); }); @@ -453,7 +453,7 @@ export function crossEnvironmentSpecs( `; const memo = await harness.memo(); await memo.sendKeys(memoStr); - expect(await memo.getProperty('value')).toBe(memoStr); + expect(await memo.getProperty('value')).toBe(memoStr); }); it('should be able to getCssValue', async () => { @@ -474,14 +474,14 @@ export function crossEnvironmentSpecs( it('should be able to get the value of a property', async () => { const input = await harness.input(); await input.sendKeys('Hello'); - expect(await input.getProperty('value')).toBe('Hello'); + expect(await input.getProperty('value')).toBe('Hello'); }); it('should be able to set the value of an input', async () => { const input = await harness.input(); await input.setInputValue('hello'); - expect(await input.getProperty('value')).toBe('hello'); + expect(await input.getProperty('value')).toBe('hello'); }); it('should be able to set the value of a select in single selection mode', async () => { diff --git a/src/material-experimental/mdc-chips/testing/chip-input-harness.ts b/src/material-experimental/mdc-chips/testing/chip-input-harness.ts index 0ab444b541eb..c6fad2f4fcbf 100644 --- a/src/material-experimental/mdc-chips/testing/chip-input-harness.ts +++ b/src/material-experimental/mdc-chips/testing/chip-input-harness.ts @@ -31,23 +31,23 @@ export class MatChipInputHarness extends ComponentHarness { /** Whether the input is disabled. */ async isDisabled(): Promise { - return (await this.host()).getProperty('disabled')!; + return (await this.host()).getProperty('disabled'); } /** Whether the input is required. */ async isRequired(): Promise { - return (await this.host()).getProperty('required')!; + return (await this.host()).getProperty('required'); } /** Gets the value of the input. */ async getValue(): Promise { // The "value" property of the native input is never undefined. - return (await (await this.host()).getProperty('value'))!; + return (await (await this.host()).getProperty('value')); } /** Gets the placeholder of the input. */ async getPlaceholder(): Promise { - return (await (await this.host()).getProperty('placeholder')); + return (await (await this.host()).getProperty('placeholder')); } /** diff --git a/src/material-experimental/mdc-slider/testing/slider-harness.ts b/src/material-experimental/mdc-slider/testing/slider-harness.ts index 2b46da5662a8..a9fd3b7089ba 100644 --- a/src/material-experimental/mdc-slider/testing/slider-harness.ts +++ b/src/material-experimental/mdc-slider/testing/slider-harness.ts @@ -52,7 +52,7 @@ export class MatSliderHarness extends ComponentHarness { async getStep(): Promise { // The same step value is forwarded to both thumbs. const startHost = await (await this.getEndThumb()).host(); - return coerceNumberProperty(await startHost.getProperty('step')); + return coerceNumberProperty(await startHost.getProperty('step')); } /** Gets the maximum value of the slider. */ diff --git a/src/material-experimental/mdc-slider/testing/slider-thumb-harness.ts b/src/material-experimental/mdc-slider/testing/slider-thumb-harness.ts index e905a4d73157..0a7f94245f18 100644 --- a/src/material-experimental/mdc-slider/testing/slider-thumb-harness.ts +++ b/src/material-experimental/mdc-slider/testing/slider-thumb-harness.ts @@ -38,7 +38,7 @@ export class MatSliderThumbHarness extends ComponentHarness { /** Gets the value of the thumb. */ async getValue(): Promise { - return (await (await this.host()).getProperty('valueAsNumber')); + return (await (await this.host()).getProperty('valueAsNumber')); } /** Sets the value of the thumb. */ @@ -65,12 +65,12 @@ export class MatSliderThumbHarness extends ComponentHarness { /** Gets the maximum value of the thumb. */ async getMaxValue(): Promise { - return coerceNumberProperty(await (await this.host()).getProperty('max')); + return coerceNumberProperty(await (await this.host()).getProperty('max')); } /** Gets the minimum value of the thumb. */ async getMinValue(): Promise { - return coerceNumberProperty(await (await this.host()).getProperty('min')); + return coerceNumberProperty(await (await this.host()).getProperty('min')); } /** Gets the text representation of the slider's value. */ @@ -80,17 +80,17 @@ export class MatSliderThumbHarness extends ComponentHarness { /** Whether the thumb is disabled. */ async isDisabled(): Promise { - return (await this.host()).getProperty('disabled'); + return (await this.host()).getProperty('disabled'); } /** Gets the name of the thumb. */ async getName(): Promise { - return (await (await this.host()).getProperty('name')); + return (await (await this.host()).getProperty('name')); } /** Gets the id of the thumb. */ async getId(): Promise { - return (await (await this.host()).getProperty('id')); + return (await (await this.host()).getProperty('id')); } /** diff --git a/src/material/autocomplete/testing/autocomplete-harness.ts b/src/material/autocomplete/testing/autocomplete-harness.ts index 2e74d93022ad..1009a81d6b19 100644 --- a/src/material/autocomplete/testing/autocomplete-harness.ts +++ b/src/material/autocomplete/testing/autocomplete-harness.ts @@ -38,7 +38,7 @@ export abstract class _MatAutocompleteHarnessBase< /** Gets the value of the autocomplete input. */ async getValue(): Promise { - return (await this.host()).getProperty('value'); + return (await this.host()).getProperty('value'); } /** Whether the autocomplete input is disabled. */ diff --git a/src/material/checkbox/testing/checkbox-harness.ts b/src/material/checkbox/testing/checkbox-harness.ts index 919182eefad5..75f59aa512eb 100644 --- a/src/material/checkbox/testing/checkbox-harness.ts +++ b/src/material/checkbox/testing/checkbox-harness.ts @@ -21,13 +21,13 @@ export abstract class _MatCheckboxHarnessBase extends ComponentHarness { /** Whether the checkbox is checked. */ async isChecked(): Promise { - const checked = (await this._input()).getProperty('checked'); + const checked = (await this._input()).getProperty('checked'); return coerceBooleanProperty(await checked); } /** Whether the checkbox is in an indeterminate state. */ async isIndeterminate(): Promise { - const indeterminate = (await this._input()).getProperty('indeterminate'); + const indeterminate = (await this._input()).getProperty('indeterminate'); return coerceBooleanProperty(await indeterminate); } @@ -39,7 +39,7 @@ export abstract class _MatCheckboxHarnessBase extends ComponentHarness { /** Whether the checkbox is required. */ async isRequired(): Promise { - const required = (await this._input()).getProperty('required'); + const required = (await this._input()).getProperty('required'); return coerceBooleanProperty(await required); } @@ -56,7 +56,7 @@ export abstract class _MatCheckboxHarnessBase extends ComponentHarness { /** Gets the checkbox's value. */ async getValue(): Promise { - return (await this._input()).getProperty('value'); + return (await this._input()).getProperty('value'); } /** Gets the checkbox's aria-label. */ diff --git a/src/material/datepicker/testing/datepicker-input-harness-base.ts b/src/material/datepicker/testing/datepicker-input-harness-base.ts index 7ddc11b1e64b..0c5fac1ec6a2 100644 --- a/src/material/datepicker/testing/datepicker-input-harness-base.ts +++ b/src/material/datepicker/testing/datepicker-input-harness-base.ts @@ -31,18 +31,18 @@ export function getInputPredicate( export abstract class MatDatepickerInputHarnessBase extends MatFormFieldControlHarness { /** Whether the input is disabled. */ async isDisabled(): Promise { - return (await this.host()).getProperty('disabled')!; + return (await this.host()).getProperty('disabled'); } /** Whether the input is required. */ async isRequired(): Promise { - return (await this.host()).getProperty('required')!; + return (await this.host()).getProperty('required'); } /** Gets the value of the input. */ async getValue(): Promise { // The "value" property of the native input is always defined. - return (await (await this.host()).getProperty('value'))!; + return (await (await this.host()).getProperty('value')); } /** @@ -65,7 +65,7 @@ export abstract class MatDatepickerInputHarnessBase extends MatFormFieldControlH /** Gets the placeholder of the input. */ async getPlaceholder(): Promise { - return (await (await this.host()).getProperty('placeholder')); + return (await (await this.host()).getProperty('placeholder')); } /** diff --git a/src/material/input/testing/input-harness.ts b/src/material/input/testing/input-harness.ts index 5617e9ef0b72..8c0cfe2f0271 100644 --- a/src/material/input/testing/input-harness.ts +++ b/src/material/input/testing/input-harness.ts @@ -35,29 +35,29 @@ export class MatInputHarness extends MatFormFieldControlHarness { /** Whether the input is disabled. */ async isDisabled(): Promise { - return (await this.host()).getProperty('disabled')!; + return (await this.host()).getProperty('disabled'); } /** Whether the input is required. */ async isRequired(): Promise { - return (await this.host()).getProperty('required')!; + return (await this.host()).getProperty('required'); } /** Whether the input is readonly. */ async isReadonly(): Promise { - return (await this.host()).getProperty('readOnly')!; + return (await this.host()).getProperty('readOnly'); } /** Gets the value of the input. */ async getValue(): Promise { // The "value" property of the native input is never undefined. - return (await (await this.host()).getProperty('value'))!; + return (await (await this.host()).getProperty('value')); } /** Gets the name of the input. */ async getName(): Promise { // The "name" property of the native input is never undefined. - return (await (await this.host()).getProperty('name'))!; + return (await (await this.host()).getProperty('name')); } /** @@ -66,7 +66,7 @@ export class MatInputHarness extends MatFormFieldControlHarness { */ async getType(): Promise { // The "type" property of the native input is never undefined. - return (await (await this.host()).getProperty('type'))!; + return (await (await this.host()).getProperty('type')); } /** Gets the placeholder of the input. */ @@ -83,7 +83,7 @@ export class MatInputHarness extends MatFormFieldControlHarness { async getId(): Promise { // The input directive always assigns a unique id to the input in // case no id has been explicitly specified. - return (await (await this.host()).getProperty('id'))!; + return (await (await this.host()).getProperty('id')); } /** diff --git a/src/material/input/testing/native-option-harness.ts b/src/material/input/testing/native-option-harness.ts index 63085135581f..6ea606c97b95 100644 --- a/src/material/input/testing/native-option-harness.ts +++ b/src/material/input/testing/native-option-harness.ts @@ -34,21 +34,21 @@ export class MatNativeOptionHarness extends ComponentHarness { /** Gets the option's label text. */ async getText(): Promise { - return (await this.host()).getProperty('label'); + return (await this.host()).getProperty('label'); } /** Index of the option within the native `select` element. */ async getIndex(): Promise { - return (await this.host()).getProperty('index'); + return (await this.host()).getProperty('index'); } /** Gets whether the option is disabled. */ async isDisabled(): Promise { - return (await this.host()).getProperty('disabled'); + return (await this.host()).getProperty('disabled'); } /** Gets whether the option is selected. */ async isSelected(): Promise { - return (await this.host()).getProperty('selected'); + return (await this.host()).getProperty('selected'); } } diff --git a/src/material/input/testing/native-select-harness.ts b/src/material/input/testing/native-select-harness.ts index 3360d4ab7d79..3b39d1c4ef26 100644 --- a/src/material/input/testing/native-select-harness.ts +++ b/src/material/input/testing/native-select-harness.ts @@ -31,29 +31,29 @@ export class MatNativeSelectHarness extends MatFormFieldControlHarness { /** Gets a boolean promise indicating if the select is disabled. */ async isDisabled(): Promise { - return (await this.host()).getProperty('disabled'); + return (await this.host()).getProperty('disabled'); } /** Gets a boolean promise indicating if the select is required. */ async isRequired(): Promise { - return (await this.host()).getProperty('required'); + return (await this.host()).getProperty('required'); } /** Gets a boolean promise indicating if the select is in multi-selection mode. */ async isMultiple(): Promise { - return (await this.host()).getProperty('multiple'); + return (await this.host()).getProperty('multiple'); } /** Gets the name of the select. */ async getName(): Promise { // The "name" property of the native select is never undefined. - return (await (await this.host()).getProperty('name'))!; + return (await (await this.host()).getProperty('name')); } /** Gets the id of the select. */ async getId(): Promise { // We're guaranteed to have an id, because the `matNativeControl` always assigns one. - return (await (await this.host()).getProperty('id'))!; + return (await (await this.host()).getProperty('id')); } /** Focuses the select and returns a void promise that indicates when the action is complete. */ diff --git a/src/material/radio/testing/radio-harness.ts b/src/material/radio/testing/radio-harness.ts index fbf3dc4c499e..b40bf5fb201f 100644 --- a/src/material/radio/testing/radio-harness.ts +++ b/src/material/radio/testing/radio-harness.ts @@ -52,7 +52,7 @@ export abstract class _MatRadioGroupHarnessBase< /** Gets the id of the radio-group. */ async getId(): Promise { - return (await this.host()).getProperty('id'); + return (await this.host()).getProperty('id'); } /** Gets the checked radio-button in a radio-group. */ @@ -185,7 +185,7 @@ export abstract class _MatRadioButtonHarnessBase extends ComponentHarness { /** Whether the radio-button is checked. */ async isChecked(): Promise { - const checked = (await this._input()).getProperty('checked'); + const checked = (await this._input()).getProperty('checked'); return coerceBooleanProperty(await checked); } @@ -208,7 +208,7 @@ export abstract class _MatRadioButtonHarnessBase extends ComponentHarness { /** Gets the radio-button's id. */ async getId(): Promise { - return (await this.host()).getProperty('id'); + return (await this.host()).getProperty('id'); } /** diff --git a/src/material/slide-toggle/testing/slide-toggle-harness.ts b/src/material/slide-toggle/testing/slide-toggle-harness.ts index 30287dca7cc5..c7168ad6237f 100644 --- a/src/material/slide-toggle/testing/slide-toggle-harness.ts +++ b/src/material/slide-toggle/testing/slide-toggle-harness.ts @@ -19,7 +19,7 @@ export abstract class _MatSlideToggleHarnessBase extends ComponentHarness { /** Whether the slide-toggle is checked. */ async isChecked(): Promise { - const checked = (await this._input()).getProperty('checked'); + const checked = (await this._input()).getProperty('checked'); return coerceBooleanProperty(await checked); } diff --git a/tools/public_api_guard/cdk/testing-protractor.d.ts b/tools/public_api_guard/cdk/testing-protractor.d.ts index cbe7dff0ef4c..ffae5f1bf844 100644 --- a/tools/public_api_guard/cdk/testing-protractor.d.ts +++ b/tools/public_api_guard/cdk/testing-protractor.d.ts @@ -11,7 +11,7 @@ export declare class ProtractorElement implements TestElement { getAttribute(name: string): Promise; getCssValue(property: string): Promise; getDimensions(): Promise; - getProperty(name: string): Promise; + getProperty(name: string): Promise; hasClass(name: string): Promise; hover(): Promise; isFocused(): Promise; diff --git a/tools/public_api_guard/cdk/testing-selenium-webdriver.d.ts b/tools/public_api_guard/cdk/testing-selenium-webdriver.d.ts index c8b200c12921..73a9a1c81e88 100644 --- a/tools/public_api_guard/cdk/testing-selenium-webdriver.d.ts +++ b/tools/public_api_guard/cdk/testing-selenium-webdriver.d.ts @@ -11,7 +11,7 @@ export declare class SeleniumWebDriverElement implements TestElement { getAttribute(name: string): Promise; getCssValue(property: string): Promise; getDimensions(): Promise; - getProperty(name: string): Promise; + getProperty(name: string): Promise; hasClass(name: string): Promise; hover(): Promise; isFocused(): Promise; diff --git a/tools/public_api_guard/cdk/testing-testbed.d.ts b/tools/public_api_guard/cdk/testing-testbed.d.ts index 389ac3ec74b4..dd78ea0502e2 100644 --- a/tools/public_api_guard/cdk/testing-testbed.d.ts +++ b/tools/public_api_guard/cdk/testing-testbed.d.ts @@ -29,7 +29,7 @@ export declare class UnitTestElement implements TestElement { getAttribute(name: string): Promise; getCssValue(property: string): Promise; getDimensions(): Promise; - getProperty(name: string): Promise; + getProperty(name: string): Promise; hasClass(name: string): Promise; hover(): Promise; isFocused(): Promise; diff --git a/tools/public_api_guard/cdk/testing.d.ts b/tools/public_api_guard/cdk/testing.d.ts index 46d7eabbf99d..b2c2793a8cbb 100644 --- a/tools/public_api_guard/cdk/testing.d.ts +++ b/tools/public_api_guard/cdk/testing.d.ts @@ -159,7 +159,7 @@ export interface TestElement { getAttribute(name: string): Promise; getCssValue(property: string): Promise; getDimensions(): Promise; - getProperty(name: string): Promise; + getProperty(name: string): Promise; hasClass(name: string): Promise; hover(): Promise; isFocused(): Promise;