fixes tests so they correctly pass in fiber

This commit is contained in:
Dominic Gannaway 2017-03-06 15:15:18 +00:00
parent b67a29a8ab
commit af4d249aa9
4 changed files with 4 additions and 69 deletions

View File

@ -1,61 +1,3 @@
src/renderers/__tests__/ReactComponentTreeHook-test.js
* uses displayName or Unknown for classic components
* uses displayName, name, or ReactComponent for modern components
* uses displayName, name, or Object for factory components
* uses displayName, name, or StatelessComponent for functional components
* reports a host tree correctly
* reports a simple tree with composites correctly
* reports a tree with composites correctly
* ignores null children
* ignores false children
* reports text nodes as children
* reports a single text node as a child
* reports a single number node as a child
* reports a zero as a child
* skips empty nodes for multiple children
* reports html content as no children
* updates text of a single text child
* updates from no children to a single text child
* updates from a single text child to no children
* updates from html content to a single text child
* updates from a single text child to html content
* updates from no children to multiple text children
* updates from multiple text children to no children
* updates from html content to multiple text children
* updates from multiple text children to html content
* updates from html content to no children
* updates from no children to html content
* updates from one text child to multiple text children
* updates from multiple text children to one text child
* updates text nodes when reordering
* updates host nodes when reordering with keys
* updates host nodes when reordering without keys
* updates a single composite child of a different type
* updates a single composite child of the same type
* updates from no children to a single composite child
* updates from a single composite child to no children
* updates mixed children
* updates with a host child
* updates from null to a host child
* updates from a host child to null
* updates from a host child to a composite child
* updates from a composite child to a host child
* updates from null to a composite child
* updates from a composite child to null
* updates with a host child
* updates from null to a host child
* updates from a host child to null
* updates from a host child to a composite child
* updates from a composite child to a host child
* updates from null to a composite child
* updates from a composite child to null
* tracks owner correctly
* purges unmounted components automatically
* reports update counts
* does not report top-level wrapper as a root
* registers inlined text nodes
* works
src/renderers/__tests__/ReactComponentTreeHook-test.native.js src/renderers/__tests__/ReactComponentTreeHook-test.native.js
* uses displayName or Unknown for classic components * uses displayName or Unknown for classic components
* uses displayName, name, or ReactComponent for modern components * uses displayName, name, or ReactComponent for modern components

View File

@ -182,10 +182,7 @@ function describeID(id: DebugID): string {
'building stack', 'building stack',
id id
); );
if (element && name) { return describeComponentFrame(name || '', element && element._source, ownerName || '');
return describeComponentFrame(name || '', element._source, ownerName || '');
}
return '';
} }
var ReactComponentTreeHook = { var ReactComponentTreeHook = {

View File

@ -1736,7 +1736,7 @@ describe('ReactComponentTreeHook', () => {
expectDev(ReactComponentTreeTestUtils.getRegisteredDisplayNames()).toEqual([]); expectDev(ReactComponentTreeTestUtils.getRegisteredDisplayNames()).toEqual([]);
}); });
describe('stack addenda', () => { describe.only('stack addenda', () => {
it('gets created', () => { it('gets created', () => {
function getAddendum(element) { function getAddendum(element) {
var addendum = ReactComponentTreeHook.getCurrentStackAddendum(element); var addendum = ReactComponentTreeHook.getCurrentStackAddendum(element);

View File

@ -22,9 +22,8 @@ var {
var getComponentName = require('getComponentName'); var getComponentName = require('getComponentName');
import type { Fiber } from 'ReactFiber'; import type { Fiber } from 'ReactFiber';
import type { Source } from 'ReactElementType';
function describeComponentFrame(name, source: Source, ownerName) { function describeComponentFrame(name, source: any, ownerName) {
return '\n in ' + (name || 'Unknown') + ( return '\n in ' + (name || 'Unknown') + (
source ? source ?
' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' +
@ -48,10 +47,7 @@ function describeFiber(fiber : Fiber) : string {
if (owner) { if (owner) {
ownerName = getComponentName(owner); ownerName = getComponentName(owner);
} }
if (source) { return describeComponentFrame(name, source, ownerName);
return describeComponentFrame(name, source, ownerName);
}
return '';
default: default:
return ''; return '';
} }