Skip to content

Commit

Permalink
Add more SSR unit tests for elements and children. (facebook#9221)
Browse files Browse the repository at this point in the history
* Adding more SSR unit tests for elements and children.

* Some of my SSR tests were testing for react-text and react-empty elements that no longer exist in Fiber. Fixed the tests so that they expect correct markup in Fiber.

* Tweaked some test names after @gaearon review comment facebook#9221 (comment) . Also realized that one of the tests was essentially a direct copy of another, so deleted it.

* Responding to code review facebook#9221 (review) . Thanks @spicyj!
  • Loading branch information
aickin authored and gaearon committed Mar 24, 2017
1 parent 7dba33b commit 60e78e3
Show file tree
Hide file tree
Showing 4 changed files with 778 additions and 0 deletions.
56 changes: 56 additions & 0 deletions scripts/fiber/tests-failing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,62 @@ src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js
* renders unknown attributes for custom elements with client render on top of good server markup
* renders unknown attributes for custom elements using is with client render on top of good server markup
* renders no HTML events with client render on top of good server markup
* renders a div with text with client render on top of good server markup
* renders a div with text with flanking whitespace with client render on top of good server markup
* renders a div with an empty text child with client render on top of good server markup
* renders a div with multiple empty text children with server string render
* renders a div with multiple empty text children with client render on top of good server markup
* renders a div with multiple whitespace children with server string render
* renders a div with multiple whitespace children with client render on top of good server markup
* renders a div with text sibling to a node with server string render
* renders a div with text sibling to a node with client render on top of good server markup
* renders a non-standard element with text with client render on top of good server markup
* renders a custom element with text with client render on top of good server markup
* renders a leading blank child with a text sibling with server string render
* renders a leading blank child with a text sibling with client render on top of good server markup
* renders a trailing blank child with a text sibling with server string render
* renders a trailing blank child with a text sibling with client render on top of good server markup
* renders an element with two text children with server string render
* renders an element with two text children with client render on top of good server markup
* renders a number as single child with client render on top of good server markup
* renders zero as single child with client render on top of good server markup
* renders an element with number and text children with server string render
* renders an element with number and text children with client render on top of good server markup
* renders null single child as blank with client render on top of good server markup
* renders false single child as blank with client render on top of good server markup
* renders undefined single child as blank with client render on top of good server markup
* renders a null component children as empty with server string render
* renders a null component children as empty with client render on top of good server markup
* renders null children as blank with server string render
* renders null children as blank with client render on top of good server markup
* renders false children as blank with server string render
* renders false children as blank with client render on top of good server markup
* renders null and false children together as blank with server string render
* renders null and false children together as blank with client render on top of good server markup
* renders only null and false children as blank with client render on top of good server markup
* renders an svg element with client render on top of good server markup
* renders svg element with an xlink with client render on top of good server markup
* renders a math element with client render on top of good server markup
* renders an img with client render on top of good server markup
* renders a button with client render on top of good server markup
* renders a div with dangerouslySetInnerHTML with client render on top of good server markup
* renders a newline-eating tag with content not starting with \n with client render on top of good server markup
* renders a newline-eating tag with content starting with \n with client render on top of good server markup
* renders a normal tag with content starting with \n with client render on top of good server markup
* renders stateless components with client render on top of good server markup
* renders ES6 class components with client render on top of good server markup
* renders factory components with client render on top of good server markup
* renders single child hierarchies of components with client render on top of good server markup
* renders multi-child hierarchies of components with client render on top of good server markup
* renders a div with a child with client render on top of good server markup
* renders a div with multiple children with client render on top of good server markup
* renders a div with multiple children separated by whitespace with server string render
* renders a div with multiple children separated by whitespace with client render on top of good server markup
* renders a div with a single child surrounded by whitespace with server string render
* renders a div with a single child surrounded by whitespace with client render on top of good server markup
* renders >,<, and & as single child with client render on top of good server markup
* renders >,<, and & as multiple children with server string render
* renders >,<, and & as multiple children with client render on top of good server markup

src/renderers/dom/shared/__tests__/ReactDOMTextComponent-test.js
* can reconcile text merged by Node.normalize() alongside other elements
Expand Down
48 changes: 48 additions & 0 deletions scripts/fiber/tests-passing-except-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,54 @@ src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js
* renders unknown attributes for custom elements with client render on top of bad server markup
* renders unknown attributes for custom elements using is with client render on top of bad server markup
* renders no HTML events with client render on top of bad server markup
* renders a div with text with client render on top of bad server markup
* renders a div with text with flanking whitespace with client render on top of bad server markup
* renders a div with an empty text child with client render on top of bad server markup
* renders a div with multiple empty text children with client render on top of bad server markup
* renders a div with multiple whitespace children with client render on top of bad server markup
* renders a div with text sibling to a node with client render on top of bad server markup
* renders a non-standard element with text with client render on top of bad server markup
* renders a custom element with text with client render on top of bad server markup
* renders a leading blank child with a text sibling with client render on top of bad server markup
* renders a trailing blank child with a text sibling with client render on top of bad server markup
* renders an element with two text children with client render on top of bad server markup
* renders a number as single child with client render on top of bad server markup
* renders zero as single child with client render on top of bad server markup
* renders an element with number and text children with client render on top of bad server markup
* renders null single child as blank with client render on top of bad server markup
* renders false single child as blank with client render on top of bad server markup
* renders undefined single child as blank with client render on top of bad server markup
* renders a null component children as empty with client render on top of bad server markup
* renders null children as blank with client render on top of bad server markup
* renders false children as blank with client render on top of bad server markup
* renders null and false children together as blank with client render on top of bad server markup
* renders only null and false children as blank with client render on top of bad server markup
* renders an svg element with client render on top of bad server markup
* renders svg element with an xlink with client render on top of bad server markup
* renders a math element with client render on top of bad server markup
* renders an img with client render on top of bad server markup
* renders a button with client render on top of bad server markup
* renders a div with dangerouslySetInnerHTML with client render on top of bad server markup
* renders a newline-eating tag with content not starting with \n with client render on top of bad server markup
* renders a newline-eating tag with content starting with \n with client render on top of bad server markup
* renders a normal tag with content starting with \n with client render on top of bad server markup
* renders stateless components with client render on top of bad server markup
* renders ES6 class components with client render on top of bad server markup
* renders factory components with client render on top of bad server markup
* renders single child hierarchies of components with client render on top of bad server markup
* renders multi-child hierarchies of components with client render on top of bad server markup
* renders a div with a child with client render on top of bad server markup
* renders a div with multiple children with client render on top of bad server markup
* renders a div with multiple children separated by whitespace with client render on top of bad server markup
* renders a div with a single child surrounded by whitespace with client render on top of bad server markup
* renders >,<, and & as single child with client render on top of bad server markup
* renders >,<, and & as multiple children with client render on top of bad server markup
* throws when rendering a string component with clean client render
* throws when rendering a string component with client render on top of bad server markup
* throws when rendering an undefined component with clean client render
* throws when rendering an undefined component with client render on top of bad server markup
* throws when rendering a number component with clean client render
* throws when rendering a number component with client render on top of bad server markup

src/renderers/dom/shared/__tests__/ReactMount-test.js
* should warn if mounting into dirty rendered markup
Expand Down
88 changes: 88 additions & 0 deletions scripts/fiber/tests-passing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,94 @@ src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js
* renders unknown attributes for custom elements using is with clean client render
* renders no HTML events with server string render
* renders no HTML events with clean client render
* renders a div with text with server string render
* renders a div with text with clean client render
* renders a div with text with flanking whitespace with server string render
* renders a div with text with flanking whitespace with clean client render
* renders a div with an empty text child with server string render
* renders a div with an empty text child with clean client render
* renders a div with multiple empty text children with clean client render
* renders a div with multiple whitespace children with clean client render
* renders a div with text sibling to a node with clean client render
* renders a non-standard element with text with server string render
* renders a non-standard element with text with clean client render
* renders a custom element with text with server string render
* renders a custom element with text with clean client render
* renders a leading blank child with a text sibling with clean client render
* renders a trailing blank child with a text sibling with clean client render
* renders an element with two text children with clean client render
* renders a number as single child with server string render
* renders a number as single child with clean client render
* renders zero as single child with server string render
* renders zero as single child with clean client render
* renders an element with number and text children with clean client render
* renders null single child as blank with server string render
* renders null single child as blank with clean client render
* renders false single child as blank with server string render
* renders false single child as blank with clean client render
* renders undefined single child as blank with server string render
* renders undefined single child as blank with clean client render
* renders a null component children as empty with clean client render
* renders null children as blank with clean client render
* renders false children as blank with clean client render
* renders null and false children together as blank with clean client render
* renders only null and false children as blank with server string render
* renders only null and false children as blank with clean client render
* renders an svg element with server string render
* renders an svg element with clean client render
* renders svg element with an xlink with server string render
* renders svg element with an xlink with clean client render
* renders a math element with server string render
* renders a math element with clean client render
* renders an img with server string render
* renders an img with clean client render
* renders a button with server string render
* renders a button with clean client render
* renders a div with dangerouslySetInnerHTML with server string render
* renders a div with dangerouslySetInnerHTML with clean client render
* renders a newline-eating tag with content not starting with \n with server string render
* renders a newline-eating tag with content not starting with \n with clean client render
* renders a newline-eating tag with content starting with \n with server string render
* renders a newline-eating tag with content starting with \n with clean client render
* renders a normal tag with content starting with \n with server string render
* renders a normal tag with content starting with \n with clean client render
* renders stateless components with server string render
* renders stateless components with clean client render
* renders ES6 class components with server string render
* renders ES6 class components with clean client render
* renders factory components with server string render
* renders factory components with clean client render
* renders single child hierarchies of components with server string render
* renders single child hierarchies of components with clean client render
* renders multi-child hierarchies of components with server string render
* renders multi-child hierarchies of components with clean client render
* renders a div with a child with server string render
* renders a div with a child with clean client render
* renders a div with multiple children with server string render
* renders a div with multiple children with clean client render
* renders a div with multiple children separated by whitespace with clean client render
* renders a div with a single child surrounded by whitespace with clean client render
* renders >,<, and & as single child with server string render
* renders >,<, and & as single child with clean client render
* renders >,<, and & as multiple children with clean client render
* throws when rendering a string component with server string render
* throws when rendering an undefined component with server string render
* throws when rendering a number component with server string render
* throws when rendering null with server string render
* throws when rendering null with clean client render
* throws when rendering null with client render on top of bad server markup
* throws when rendering false with server string render
* throws when rendering false with clean client render
* throws when rendering false with client render on top of bad server markup
* throws when rendering undefined with server string render
* throws when rendering undefined with clean client render
* throws when rendering undefined with client render on top of bad server markup
* throws when rendering number with server string render
* throws when rendering number with clean client render
* throws when rendering number with client render on top of bad server markup
* throws when rendering string with server string render
* throws when rendering string with clean client render
* throws when rendering string with client render on top of bad server markup

src/renderers/dom/shared/__tests__/ReactDOMTextComponent-test.js
* updates a mounted text component in place
Expand Down
Loading

0 comments on commit 60e78e3

Please sign in to comment.