Skip to content

Commit 384fc97

Browse files
committed
Core data: Finish deferred selection updates in RTC test
1 parent 2655c4a commit 384fc97

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎packages/core-data/src/test/rtc-rich-text-offset-space.jsdom.test.jsx‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ describe( 'useEntityBlockEditor RTC rich-text offset-space bug', () => {
122122
} );
123123

124124
afterEach( () => {
125+
if ( vi.isFakeTimers() ) {
126+
// Finish selection updates before destroying their document.
127+
vi.runOnlyPendingTimers();
128+
vi.useRealTimers();
129+
}
125130
crdtDoc.destroy();
126131
mockGetSyncManager.mockReset();
127132
if (
@@ -151,6 +156,8 @@ describe( 'useEntityBlockEditor RTC rich-text offset-space bug', () => {
151156
);
152157

153158
await waitFor( () => expect( blocks ).toHaveLength( 1 ) );
159+
// Keep the async render setup on real timers.
160+
vi.useFakeTimers();
154161

155162
const selection = {
156163
selectionStart: {

0 commit comments

Comments
 (0)