Skip to content

Commit 4244ffa

Browse files
author
Brian Vaughn
committed
Fixed last test but with an unsatisfying solution
1 parent 9fd6735 commit 4244ffa

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

packages/react-devtools-shared/src/__tests__/inspectedElement-test.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ describe('InspectedElement', () => {
270270
done();
271271
});
272272

273-
xit('should poll for updates for the currently selected element', async done => {
273+
it('should poll for updates for the currently selected element', async done => {
274274
const Example = () => null;
275275

276276
const container = document.createElement('div');
@@ -311,7 +311,16 @@ describe('InspectedElement', () => {
311311
false,
312312
);
313313

314-
inspectedElement = null;
314+
// TODO (cache)
315+
// This test only passes if both the check-for-updates poll AND the test renderer.update() call are included below.
316+
// It seems like either one of the two should be sufficient but:
317+
// 1. Running only check-for-updates schedules a transition that React never renders.
318+
// 2. Running only renderer.update() loads stale data (first props)
319+
320+
// Wait for our check-for-updates poll to get the new data.
321+
jest.runOnlyPendingTimers();
322+
await Promise.resolve();
323+
315324
await utils.actAsync(
316325
() =>
317326
renderer.update(

0 commit comments

Comments
 (0)