From 091d7fda48a6515d3a6c2e490b0db359705faa62 Mon Sep 17 00:00:00 2001 From: Sasha Aickin Date: Mon, 20 Mar 2017 21:39:09 -0400 Subject: [PATCH] Tweaked some test names after @gaearon review comment https://github.com/facebook/react/pull/9221#discussion_r107045673 . Also realized that one of the tests was essentially a direct copy of another, so deleted it. --- scripts/fiber/tests-failing.txt | 33 ++- scripts/fiber/tests-passing-except-dev.txt | 19 +- scripts/fiber/tests-passing.txt | 24 +- .../ReactDOMServerIntegration-test.js | 208 ++++++++---------- 4 files changed, 131 insertions(+), 153 deletions(-) diff --git a/scripts/fiber/tests-failing.txt b/scripts/fiber/tests-failing.txt index 0ffd049d086c1..36ad7b4337945 100644 --- a/scripts/fiber/tests-failing.txt +++ b/scripts/fiber/tests-failing.txt @@ -48,27 +48,26 @@ src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js * 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 text with client render on top of good server markup -* renders a div with blank text child with client render on top of good server markup -* renders renders a div with blank text children with server string render -* renders renders a div with blank text children with client render on top of good server markup -* renders a div with whitespace children with server string render -* renders a div with whitespace children with client render on top of good server markup +* renders a div with text child in brackets 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 leading blank children with comments when there are multiple children with server string render -* renders leading blank children with comments when there are multiple children with client render on top of good server markup -* renders trailing blank children with comments when there are multiple children with server string render -* renders trailing blank children with comments when there are multiple children with client render on top of good server markup -* renders an element with just one text child without comments with client render on top of good server markup -* renders an element with two text children with comments with server string render -* renders an element with two text children with comments 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 comments with server string render -* renders an element with number and text children with comments 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 @@ -100,8 +99,8 @@ src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js * 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 child surrounded by whitespace with server string render -* renders a div with a child surrounded 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 diff --git a/scripts/fiber/tests-passing-except-dev.txt b/scripts/fiber/tests-passing-except-dev.txt index f01c163abc97b..4795e40e60aeb 100644 --- a/scripts/fiber/tests-passing-except-dev.txt +++ b/scripts/fiber/tests-passing-except-dev.txt @@ -49,20 +49,19 @@ src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js * 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 text with client render on top of bad server markup -* renders a div with blank text child with client render on top of bad server markup -* renders renders a div with blank text children with client render on top of bad server markup -* renders a div with whitespace children with client render on top of bad server markup +* renders a div with text child in brackets 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 leading blank children with comments when there are multiple children with client render on top of bad server markup -* renders trailing blank children with comments when there are multiple children with client render on top of bad server markup -* renders an element with just one text child without comments with client render on top of bad server markup -* renders an element with two text children with comments 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 comments 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 @@ -89,7 +88,7 @@ src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js * 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 child surrounded 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 diff --git a/scripts/fiber/tests-passing.txt b/scripts/fiber/tests-passing.txt index 454a96096505f..f8673c4fe4d5f 100644 --- a/scripts/fiber/tests-passing.txt +++ b/scripts/fiber/tests-passing.txt @@ -1142,27 +1142,25 @@ src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js * 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 text with server string render -* renders a div with text with clean client render -* renders a div with blank text child with server string render -* renders a div with blank text child with clean client render -* renders renders a div with blank text children with clean client render -* renders a div with whitespace children with clean client render +* renders a div with text child in brackets with server string render +* renders a div with text child in brackets 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 leading blank children with comments when there are multiple children with clean client render -* renders trailing blank children with comments when there are multiple children with clean client render -* renders an element with just one text child without comments with server string render -* renders an element with just one text child without comments with clean client render -* renders an element with two text children with comments 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 comments 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 @@ -1210,7 +1208,7 @@ src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js * 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 child surrounded 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 diff --git a/src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js b/src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js index 8715e4444bc09..35d99e1e513e9 100644 --- a/src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js +++ b/src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js @@ -484,18 +484,18 @@ describe('ReactDOMServerIntegration', () => { expectNode(e.childNodes[0], TEXT_NODE_TYPE, ' Text '); }); - itRenders('a div with text', async render => { + itRenders('a div with text child in brackets', async render => { const e = await render(
{'Text'}
); expect(e.childNodes.length).toBe(1); expectNode(e.firstChild, TEXT_NODE_TYPE, 'Text'); }); - itRenders('a div with blank text child', async render => { + itRenders('a div with an empty text child', async render => { const e = await render(
{''}
); expect(e.childNodes.length).toBe(0); }); - itRenders('renders a div with blank text children', async render => { + itRenders('a div with multiple empty text children', async render => { const e = await render(
{''}{''}{''}
); if (ReactDOMFeatureFlags.useFiber) { // with Fiber, there are just three separate text node children, @@ -513,7 +513,7 @@ describe('ReactDOMServerIntegration', () => { } }); - itRenders('a div with whitespace children', async render => { + itRenders('a div with multiple whitespace children', async render => { const e = await render(
{' '}{' '}{' '}
); if (ReactDOMFeatureFlags.useFiber) { // with Fiber, there are just three text nodes. @@ -565,73 +565,55 @@ describe('ReactDOMServerIntegration', () => { expectNode(e.firstChild, TEXT_NODE_TYPE, 'Text'); }); - itRenders( - 'leading blank children with comments when there are multiple children', - async render => { - const e = await render(
{''}foo
); - if (ReactDOMFeatureFlags.useFiber) { - // with Fiber, there are just two text nodes. - expect(e.childNodes.length).toBe(2); - expectTextNode(e.childNodes[0], ''); - expectTextNode(e.childNodes[1], 'foo'); - } else { - // with Stack, there are five nodes: two react-text comment nodes - // without any text between them, and the text node foo surrounded - // by react-text comment nodes. - expect(e.childNodes.length).toBe(5); - expectTextNode(e.childNodes[0], ''); - expectTextNode(e.childNodes[2], 'foo'); - } - }, - ); - - itRenders( - 'trailing blank children with comments when there are multiple children', - async render => { - const e = await render(
foo{''}
); - if (ReactDOMFeatureFlags.useFiber) { - // with Fiber, there are just two text nodes. - expect(e.childNodes.length).toBe(2); - expectTextNode(e.childNodes[0], 'foo'); - expectTextNode(e.childNodes[1], ''); - } else { - // with Stack, there are five nodes: the text node foo surrounded - // by react-text comment nodes, and two react-text comment nodes - // without any text between them. - expect(e.childNodes.length).toBe(5); - expectTextNode(e.childNodes[0], 'foo'); - expectTextNode(e.childNodes[3], ''); - } - }, - ); + itRenders('a leading blank child with a text sibling', async render => { + const e = await render(
{''}foo
); + if (ReactDOMFeatureFlags.useFiber) { + // with Fiber, there are just two text nodes. + expect(e.childNodes.length).toBe(2); + expectTextNode(e.childNodes[0], ''); + expectTextNode(e.childNodes[1], 'foo'); + } else { + // with Stack, there are five nodes: two react-text comment nodes + // without any text between them, and the text node foo surrounded + // by react-text comment nodes. + expect(e.childNodes.length).toBe(5); + expectTextNode(e.childNodes[0], ''); + expectTextNode(e.childNodes[2], 'foo'); + } + }); - itRenders( - 'an element with just one text child without comments', - async render => { - const e = await render(
foo
); - expect(e.childNodes.length).toBe(1); - expectNode(e.firstChild, TEXT_NODE_TYPE, 'foo'); - }, - ); + itRenders('a trailing blank child with a text sibling', async render => { + const e = await render(
foo{''}
); + if (ReactDOMFeatureFlags.useFiber) { + // with Fiber, there are just two text nodes. + expect(e.childNodes.length).toBe(2); + expectTextNode(e.childNodes[0], 'foo'); + expectTextNode(e.childNodes[1], ''); + } else { + // with Stack, there are five nodes: the text node foo surrounded + // by react-text comment nodes, and two react-text comment nodes + // without any text between them. + expect(e.childNodes.length).toBe(5); + expectTextNode(e.childNodes[0], 'foo'); + expectTextNode(e.childNodes[3], ''); + } + }); - itRenders( - 'an element with two text children with comments', - async render => { - const e = await render(
{'foo'}{'bar'}
); - if (ReactDOMFeatureFlags.useFiber) { - // with Fiber, there are just two text nodes. - expect(e.childNodes.length).toBe(2); - expectTextNode(e.childNodes[0], 'foo'); - expectTextNode(e.childNodes[1], 'bar'); - } else { - // with Stack, there are six nodes: two text nodes, each surrounded - // by react-text comment nodes. - expect(e.childNodes.length).toBe(6); - expectTextNode(e.childNodes[0], 'foo'); - expectTextNode(e.childNodes[3], 'bar'); - } - }, - ); + itRenders('an element with two text children', async render => { + const e = await render(
{'foo'}{'bar'}
); + if (ReactDOMFeatureFlags.useFiber) { + // with Fiber, there are just two text nodes. + expect(e.childNodes.length).toBe(2); + expectTextNode(e.childNodes[0], 'foo'); + expectTextNode(e.childNodes[1], 'bar'); + } else { + // with Stack, there are six nodes: two text nodes, each surrounded + // by react-text comment nodes. + expect(e.childNodes.length).toBe(6); + expectTextNode(e.childNodes[0], 'foo'); + expectTextNode(e.childNodes[3], 'bar'); + } + }); }); describe('number children', function() { @@ -646,24 +628,21 @@ describe('ReactDOMServerIntegration', () => { expect(e.textContent).toBe('0'); }); - itRenders( - 'an element with number and text children with comments', - async render => { - const e = await render(
{'foo'}{40}
); - if (ReactDOMFeatureFlags.useFiber) { - // with Fiber, there are just two text nodes. - expect(e.childNodes.length).toBe(2); - expectTextNode(e.childNodes[0], 'foo'); - expectTextNode(e.childNodes[1], '40'); - } else { - // with Stack, there are six nodes: two text nodes, each surrounded - // by react-text comment nodes. - expect(e.childNodes.length).toBe(6); - expectTextNode(e.childNodes[0], 'foo'); - expectTextNode(e.childNodes[3], '40'); - } - }, - ); + itRenders('an element with number and text children', async render => { + const e = await render(
{'foo'}{40}
); + if (ReactDOMFeatureFlags.useFiber) { + // with Fiber, there are just two text nodes. + expect(e.childNodes.length).toBe(2); + expectTextNode(e.childNodes[0], 'foo'); + expectTextNode(e.childNodes[1], '40'); + } else { + // with Stack, there are six nodes: two text nodes, each surrounded + // by react-text comment nodes. + expect(e.childNodes.length).toBe(6); + expectTextNode(e.childNodes[0], 'foo'); + expectTextNode(e.childNodes[3], '40'); + } + }); }); describe('null, false, and undefined children', function() { @@ -952,32 +931,35 @@ describe('ReactDOMServerIntegration', () => { }, ); - itRenders('a div with a child surrounded by whitespace', async render => { - // prettier-ignore - const e = await render(
); // eslint-disable-line no-multi-spaces - let textNode1, child, textNode2; - if (ReactDOMFeatureFlags.useFiber) { - // with Fiber, there are three children: a one-space text node, the - // child element, and a two-space text node. - expect(e.childNodes.length).toBe(3); - textNode1 = e.childNodes[0]; - child = e.childNodes[1]; - textNode2 = e.childNodes[2]; - } else { - // with Stack, there are 7 children: a one-space text node surrounded - // by react-text comments, the child element, and a two-space text node - // surrounded by react-text comments. - expect(e.childNodes.length).toBe(7); - textNode1 = e.childNodes[0]; - child = e.childNodes[3]; - textNode2 = e.childNodes[4]; - } - expect(e.id).toBe('parent'); - expectTextNode(textNode1, ' '); - expect(child.id).toBe('child'); - expect(child.childNodes.length).toBe(0); - expectTextNode(textNode2, ' '); - }); + itRenders( + 'a div with a single child surrounded by whitespace', + async render => { + // prettier-ignore + const e = await render(
); // eslint-disable-line no-multi-spaces + let textNode1, child, textNode2; + if (ReactDOMFeatureFlags.useFiber) { + // with Fiber, there are three children: a one-space text node, the + // child element, and a two-space text node. + expect(e.childNodes.length).toBe(3); + textNode1 = e.childNodes[0]; + child = e.childNodes[1]; + textNode2 = e.childNodes[2]; + } else { + // with Stack, there are 7 children: a one-space text node surrounded + // by react-text comments, the child element, and a two-space text node + // surrounded by react-text comments. + expect(e.childNodes.length).toBe(7); + textNode1 = e.childNodes[0]; + child = e.childNodes[3]; + textNode2 = e.childNodes[4]; + } + expect(e.id).toBe('parent'); + expectTextNode(textNode1, ' '); + expect(child.id).toBe('child'); + expect(child.childNodes.length).toBe(0); + expectTextNode(textNode2, ' '); + }, + ); }); describe('escaping >, <, and &', function() {