diff --git a/apps/common-app/src/examples/RuntimeTests/ReJest/TestRunner/TestRunner.ts b/apps/common-app/src/examples/RuntimeTests/ReJest/TestRunner/TestRunner.ts index 42b1c8a3a6e..481c5f3adf7 100644 --- a/apps/common-app/src/examples/RuntimeTests/ReJest/TestRunner/TestRunner.ts +++ b/apps/common-app/src/examples/RuntimeTests/ReJest/TestRunner/TestRunner.ts @@ -49,7 +49,6 @@ export class TestRunner { private _currentTestCase: TestCase | null = null; private _renderHook: (component: ReactElement | null) => void = () => {}; private _valueRegistry: Record = {}; - private _wasRenderedNull: boolean = false; private _includesOnly: boolean = false; private _syncUIRunner: SyncUIRunner = new SyncUIRunner(); private _renderLock: RenderLock = new RenderLock(); @@ -81,10 +80,11 @@ export class TestRunner { } public async render(component: ReactElement | null) { - if (!component && this._wasRenderedNull) { + if (!component && this._renderLock.wasRenderedNull()) { return; } - this._wasRenderedNull = !component; + + this._renderLock.setRenderedNull(!component); this._renderLock.lock(); try { diff --git a/apps/common-app/src/examples/RuntimeTests/ReJest/utils/SyncUIRunner.ts b/apps/common-app/src/examples/RuntimeTests/ReJest/utils/SyncUIRunner.ts index d8fac80feb7..ecc560bf605 100644 --- a/apps/common-app/src/examples/RuntimeTests/ReJest/utils/SyncUIRunner.ts +++ b/apps/common-app/src/examples/RuntimeTests/ReJest/utils/SyncUIRunner.ts @@ -39,6 +39,8 @@ export class SyncUIRunner extends WaitForUnlock { } export class RenderLock extends WaitForUnlock { + private _wasRenderedNull: boolean = true; + public lock() { this._setLock(true); } @@ -47,6 +49,14 @@ export class RenderLock extends WaitForUnlock { this._setLock(false); } + public wasRenderedNull() { + return this._wasRenderedNull; + } + + public setRenderedNull(wasRenderedNull: boolean) { + this._wasRenderedNull = wasRenderedNull; + } + public async waitForUnlock(maxWaitTime?: number) { await this._waitForUnlock(maxWaitTime); }