Skip to content

Commit 72f1388

Browse files
committed
Let Fiber skip react data attributes and comments in SSR tests
This markup is testing implementation details rather than behavior.
1 parent 39f1f11 commit 72f1388

4 files changed

Lines changed: 32 additions & 20 deletions

File tree

scripts/fiber/tests-failing.txt

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -108,24 +108,6 @@ src/renderers/dom/stack/client/__tests__/ReactRenderDocument-test.js
108108
* should throw on full document render w/ no markup
109109
* supports findDOMNode on full-page components
110110

111-
src/renderers/dom/stack/server/__tests__/ReactServerRendering-test.js
112-
* should generate simple markup
113-
* should generate simple markup for self-closing tags
114-
* should generate simple markup for attribute with `>` symbol
115-
* should generate comment markup for component returns null
116-
* should render composite components
117-
* should only execute certain lifecycle methods
118-
* should have the correct mounting behavior
119-
* should not put checksum and React ID on components
120-
* should not put checksum and React ID on text components
121-
* should only execute certain lifecycle methods
122-
* allows setState in componentWillMount without using DOM
123-
* renders components with different batching strategies
124-
* warns with a no-op when an async setState is triggered
125-
* warns with a no-op when an async replaceState is triggered
126-
* warns with a no-op when an async forceUpdate is triggered
127-
* should warn when children are mutated during render
128-
129111
src/renderers/shared/__tests__/ReactPerf-test.js
130112
* should count no-op update as waste
131113
* should count no-op update in child as waste
@@ -150,7 +132,6 @@ src/renderers/shared/stack/reconciler/__tests__/ReactComponentLifeCycle-test.js
150132
* should carry through each of the phases of setup
151133

152134
src/renderers/shared/stack/reconciler/__tests__/ReactCompositeComponent-test.js
153-
* should not thrash a server rendered layout with client side one
154135
* should warn about `forceUpdate` on unmounted components
155136
* should warn about `setState` on unmounted components
156137
* should warn about `setState` in render

scripts/fiber/tests-passing-except-dev.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ src/renderers/dom/stack/client/__tests__/ReactMountDestruction-test.js
6565
* should warn when unmounting a non-container root node
6666
* should warn when unmounting a non-container, non-root node
6767

68+
src/renderers/dom/stack/server/__tests__/ReactServerRendering-test.js
69+
* should have the correct mounting behavior
70+
6871
src/renderers/shared/hooks/__tests__/ReactComponentTreeHook-test.js
6972
* uses displayName or Unknown for classic components
7073
* uses displayName, name, or ReactComponent for modern components

scripts/fiber/tests-passing.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,8 +919,23 @@ src/renderers/dom/stack/client/__tests__/findDOMNode-test.js
919919
* findDOMNode should not throw an error when called within a component that is not mounted
920920

921921
src/renderers/dom/stack/server/__tests__/ReactServerRendering-test.js
922+
* should generate simple markup
923+
* should generate simple markup for self-closing tags
924+
* should generate simple markup for attribute with `>` symbol
925+
* should generate comment markup for component returns null
926+
* should render composite components
927+
* should only execute certain lifecycle methods
922928
* should throw with silly args
929+
* should not put checksum and React ID on components
930+
* should not put checksum and React ID on text components
931+
* should only execute certain lifecycle methods
923932
* should throw with silly args
933+
* allows setState in componentWillMount without using DOM
934+
* renders components with different batching strategies
935+
* warns with a no-op when an async setState is triggered
936+
* warns with a no-op when an async replaceState is triggered
937+
* warns with a no-op when an async forceUpdate is triggered
938+
* should warn when children are mutated during render
924939

925940
src/renderers/native/__tests__/ReactNativeAttributePayload-test.js
926941
* should work with simple example
@@ -1231,6 +1246,7 @@ src/renderers/shared/stack/reconciler/__tests__/ReactComponentLifeCycle-test.js
12311246
src/renderers/shared/stack/reconciler/__tests__/ReactCompositeComponent-test.js
12321247
* should support module pattern components
12331248
* should support rendering to different child types over time
1249+
* should not thrash a server rendered layout with client side one
12341250
* should react to state changes from callbacks
12351251
* should rewire refs when rendering to different child types
12361252
* should not cache old DOM nodes when switching constructors

src/renderers/dom/stack/server/__tests__/ReactServerRendering-test.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
var ExecutionEnvironment;
1515
var React;
1616
var ReactDOM;
17+
var ReactDOMFeatureFlags;
1718
var ReactDOMServer;
1819
var ReactMarkupChecksum;
1920
var ReactReconcileTransaction;
@@ -27,6 +28,7 @@ describe('ReactDOMServer', () => {
2728
jest.resetModuleRegistry();
2829
React = require('React');
2930
ReactDOM = require('ReactDOM');
31+
ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
3032
ReactMarkupChecksum = require('ReactMarkupChecksum');
3133
ReactTestUtils = require('ReactTestUtils');
3234
ReactReconcileTransaction = require('ReactReconcileTransaction');
@@ -241,7 +243,17 @@ describe('ReactDOMServer', () => {
241243

242244
var instance = ReactDOM.render(<TestComponent name="x" />, element);
243245
expect(mountCount).toEqual(3);
244-
expect(element.innerHTML).toBe(lastMarkup);
246+
247+
var expectedMarkup = lastMarkup;
248+
if (ReactDOMFeatureFlags.useFiber) {
249+
var reactMetaData = /\s+data-react[a-z-]+=\"[^\"]*\"/g;
250+
var reactComments = /<!-- \/?react-text(: \d+)? -->/g;
251+
expectedMarkup =
252+
expectedMarkup
253+
.replace(reactMetaData, '')
254+
.replace(reactComments, '');
255+
}
256+
expect(element.innerHTML).toBe(expectedMarkup);
245257

246258
// Ensure the events system works after mount into server markup
247259
expect(numClicks).toEqual(0);

0 commit comments

Comments
 (0)