Skip to content

Commit 4e69991

Browse files
committed
Fix tests
1 parent 1918e3b commit 4e69991

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

packages/react-dom/src/__tests__/ReactDOMFiber-test.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,6 +1097,8 @@ describe('ReactDOMFiber', () => {
10971097
});
10981098

10991099
it('should not update event handlers until commit', () => {
1100+
spyOnDev(console, 'error');
1101+
11001102
let ops = [];
11011103
const handlerA = () => ops.push('A');
11021104
const handlerB = () => ops.push('B');
@@ -1129,11 +1131,7 @@ describe('ReactDOMFiber', () => {
11291131
class Click extends React.Component {
11301132
constructor() {
11311133
super();
1132-
expect(() => {
1133-
node.click();
1134-
}).toErrorDev(
1135-
'Warning: unstable_flushDiscreteUpdates: Cannot flush updates when React is already rendering.',
1136-
);
1134+
node.click();
11371135
}
11381136
render() {
11391137
return null;
@@ -1183,6 +1181,16 @@ describe('ReactDOMFiber', () => {
11831181
// Any click that happens after commit, should invoke A.
11841182
click();
11851183
expect(ops).toEqual(['A']);
1184+
1185+
if (__DEV__) {
1186+
// TODO: this warning shouldn't be firing in the first place if user didn't call it.
1187+
const errorCalls = console.error.calls.count();
1188+
for (let i = 0; i < errorCalls; i++) {
1189+
expect(console.error.calls.argsFor(i)[0]).toMatch(
1190+
'unstable_flushDiscreteUpdates: Cannot flush updates when React is already rendering.',
1191+
);
1192+
}
1193+
}
11861194
});
11871195

11881196
it('should not crash encountering low-priority tree', () => {

packages/shared/forks/ReactFeatureFlags.www-dynamic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const decoupleUpdatePriorityFromScheduler = __VARIANT__;
2121
export const skipUnmountedBoundaries = __VARIANT__;
2222
export const enablePassiveEventIntervention = __VARIANT__;
2323
export const disableOnScrollBubbling = __VARIANT__;
24-
export const enableEagerRootListeners = __VARIANT__;
24+
export const enableEagerRootListeners = !__VARIANT__;
2525

2626
// Enable this flag to help with concurrent mode debugging.
2727
// It logs information to the console about React scheduling, rendering, and commit phases.

0 commit comments

Comments
 (0)