Skip to content

Commit e59e2fd

Browse files
committed
Change expectation for WWW+VARIANT because the deferRenderPhaseUpdateToNextBatch flag breaks this behavior
1 parent 4853528 commit e59e2fd

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

packages/react/src/__tests__/ReactCoffeeScriptClass-test.coffee

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,9 @@ describe 'ReactCoffeeScriptClass', ->
255255
React.createElement('span', className: @state.bar)
256256

257257
test React.createElement(Foo, initialValue: 'foo'), 'SPAN', 'bar'
258-
expect(renderCount).toBe 1
258+
# This is broken with deferRenderPhaseUpdateToNextBatch flag on.
259+
# We can't use the gate feature here because this test is also in CoffeeScript and TypeScript.
260+
expect(renderCount).toBe(if global.__WWW__ and !global.__VARIANT__ then 2 else 1)
259261

260262
it 'should warn with non-object in the initial state property', ->
261263
[['an array'], 'a string', 1234].forEach (state) ->

packages/react/src/__tests__/ReactES6Class-test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,9 @@ describe('ReactES6Class', () => {
285285
}
286286
}
287287
test(<Foo initialValue="foo" />, 'SPAN', 'bar');
288-
expect(renderCount).toBe(1);
288+
// This is broken with deferRenderPhaseUpdateToNextBatch flag on.
289+
// We can't use the gate feature here because this test is also in CoffeeScript and TypeScript.
290+
expect(renderCount).toBe(global.__WWW__ && !global.__VARIANT__ ? 2 : 1);
289291
});
290292

291293
it('should warn with non-object in the initial state property', () => {

packages/react/src/__tests__/ReactTypeScriptClass-test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,9 @@ describe('ReactTypeScriptClass', function() {
516516
it('renders only once when setting state in componentWillMount', function() {
517517
renderCount = 0;
518518
test(React.createElement(RenderOnce, {initialValue: 'foo'}), 'SPAN', 'bar');
519-
expect(renderCount).toBe(1);
519+
// This is broken with deferRenderPhaseUpdateToNextBatch flag on.
520+
// We can't use the gate feature in TypeScript.
521+
expect(renderCount).toBe(global.__WWW__ && !global.__VARIANT__ ? 2 : 1);
520522
});
521523

522524
it('should warn with non-object in the initial state property', function() {

packages/react/src/__tests__/testDefinitions/React.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
* just helpers for the unit test.
1313
*/
1414

15+
declare let global: any;
16+
1517
declare module 'react' {
1618
export class Component {
1719
props: any;

0 commit comments

Comments
 (0)