diff --git a/src/cdk-experimental/testing/protractor/protractor-element.ts b/src/cdk-experimental/testing/protractor/protractor-element.ts index 8ad28131e365..210afcb30264 100644 --- a/src/cdk-experimental/testing/protractor/protractor-element.ts +++ b/src/cdk-experimental/testing/protractor/protractor-element.ts @@ -141,4 +141,6 @@ export class ProtractorElement implements TestElement { async getProperty(name: string): Promise { return browser.executeScript(`return arguments[0][arguments[1]]`, this.element, name); } + + async forceStabilize(): Promise {} } diff --git a/src/cdk-experimental/testing/test-element.ts b/src/cdk-experimental/testing/test-element.ts index bb7a18f3ce7b..b549400ab2e6 100644 --- a/src/cdk-experimental/testing/test-element.ts +++ b/src/cdk-experimental/testing/test-element.ts @@ -90,10 +90,7 @@ export interface TestElement { /** Gets the text from the element. */ text(): Promise; - /** - * Gets the value for the given attribute from the element. If the attribute does not exist, - * falls back to reading the property. - */ + /** Gets the value for the given attribute from the element. */ getAttribute(name: string): Promise; /** Checks whether the element has the given class. */ @@ -104,4 +101,11 @@ export interface TestElement { /** Gets the value of a property of an element. */ getProperty(name: string): Promise; + + /** + * Flushes change detection and async tasks. + * In most cases it should not be necessary to call this. However, there may be some edge cases + * where it is needed to fully flush animation events. + */ + forceStabilize(): Promise; } diff --git a/src/cdk-experimental/testing/testbed/unit-test-element.ts b/src/cdk-experimental/testing/testbed/unit-test-element.ts index 117e46c61384..4b65f98daa42 100644 --- a/src/cdk-experimental/testing/testbed/unit-test-element.ts +++ b/src/cdk-experimental/testing/testbed/unit-test-element.ts @@ -137,4 +137,8 @@ export class UnitTestElement implements TestElement { await this._stabilize(); return (this.element as any)[name]; } + + async forceStabilize(): Promise { + return this._stabilize(); + } }