Skip to content

Commit a70bf21

Browse files
committed
feat(cdk-experimental/testing): Add a public stabilize method to
TestElement
1 parent fa81811 commit a70bf21

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/cdk-experimental/testing/protractor/protractor-element.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,6 @@ export class ProtractorElement implements TestElement {
136136
const {x: left, y: top} = await this.element.getLocation();
137137
return {width, height, left, top};
138138
}
139+
140+
async stabilize(): Promise<void> {}
139141
}

src/cdk-experimental/testing/test-element.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,11 @@ export interface TestElement {
101101

102102
/** Gets the dimensions of the element. */
103103
getDimensions(): Promise<ElementDimensions>;
104+
105+
/**
106+
* Flushes change detection and async tasks.
107+
* In most cases it should not be necessary to call this. However, there may be some edge cases
108+
* where it is needed to fully flush animation events.
109+
*/
110+
stabilize(): Promise<void>;
104111
}

src/cdk-experimental/testing/testbed/unit-test-element.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,8 @@ export class UnitTestElement implements TestElement {
139139
await this._stabilize();
140140
return this.element.getBoundingClientRect();
141141
}
142+
143+
async stabilize(): Promise<void> {
144+
return this._stabilize();
145+
}
142146
}

0 commit comments

Comments
 (0)