Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shallow rendering stateless components vs stateful components - different _owner #6194

Closed
bmullan91 opened this issue Mar 5, 2016 · 1 comment

Comments

@bmullan91
Copy link

Related to #5292, see https://github.com/bmullan91/react-shallow-renderer-bug for my test case and how to reproduce.

reproduce

git clone https://github.com/bmullan91/react-shallow-renderer-bug.git
cd react-shallow-renderer-bug
npm install
npm test

issue

The StatelessComponent and StatefulComponent when rendered with shallowRenderer, there outputs differ in the _owner key, see below.

test output

TAP version 13
# compare StatelessComponent shallowRenderer getRenderOutput
not ok 1 should be equivalent
  ---
    operator: deepEqual
    expected: |-
      { $$typeof: 60103, _owner: null, _store: {}, key: null, props: { children: [ 'Hello ', 'Brian' ] }, ref: null, type: 'div' }
    actual: |-
      { $$typeof: 60103, _owner: { _context: {}, _currentElement: { $$typeof: 60103, _owner: null, _store: {}, key: null, props: { name: 'Brian' }, ref: null, type: [Function] }, _instance: { _reactInternalInstance: [Circular], context: {}, props: { name: 'Brian' }, refs: {}, state: null, updater: { enqueueCallback: [Function], enqueueCallbackInternal: [Function], enqueueElementInternal: [Function], enqueueForceUpdate: [Function], enqueueReplaceProps: [Function], enqueueReplacePropsInternal: [Function], enqueueReplaceState: [Function], enqueueSetProps: [Function], enqueueSetPropsInternal: [Function], enqueueSetState: [Function], isMounted: [Function] } }, _mountOrder: 1, _pendingCallbacks: null, _pendingElement: null, _pendingForceUpdate: false, _pendingReplaceState: false, _pendingStateQueue: null, _renderedComponent: { _currentElement: [Circular], _renderedOutput: [Circular] }, _rootNodeID: '.13qyw11le68', _topLevelWrapper: null }, _store: {}, key: null, props: { children: [ 'Hello ', 'Brian' ] }, ref: null, type: 'div' }
    at: Test.<anonymous> (/Users/brianmullan/workspace/react-shallow-renderer-bug/index.js:25:5)
  ...
# compare StatefulComponent shallowRenderer getRenderOutput
ok 2 should be equivalent

1..2
# tests 2
# pass  1
# fail  1
@gaearon
Copy link
Collaborator

gaearon commented Oct 27, 2016

This was fixed in #6362.

@gaearon gaearon closed this as completed Oct 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants