Skip to content

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Feb 2, 2017

Fixes some of the tests in ReactMount-test.js, except the ones related to server-side rendering.

* should work when measurement starts during reconciliation

src/renderers/shared/hooks/__tests__/ReactComponentTreeHook-test.js
* ignores null children
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have they moved to failed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noticed that, not sure why

@acdlite
Copy link
Collaborator Author

acdlite commented Feb 2, 2017

@gaearon Ok fixed it

}

if (__DEV__) {
const isRootRenderedBySomeReact = Boolean(container._reactRootContainer);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you verify the logic here? This means if you call render on a container with existing React children created by another React, we don't warn? I guess that is consistent with before.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we currently only warn about different copies of React on unmount

it('should flush updates in the correct order across roots', () => {
var instances = [];
var updates = [];
var container = document.createElement('div');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. This looks wrong. This changes the behavior we're testing. Why doesn't it work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

componentDidMount() {
this.container = document.createElement('div');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifically we want to test that we can render into the node we already rendered.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does work the old way but it warns. Stack doesn't warn but it seems like it should?

Why doesn't Stack warn?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's allowed to render into an empty element. This test intentionally tests that so your change messes that up.

@acdlite
Copy link
Collaborator Author

acdlite commented Feb 6, 2017

@spicyj Fixed

' This may be caused by unintentionally loading two independent ' +
'copies of React.' :
''
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these strings get compressed? Would it be better if we split them into separate invariants?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if error code transform was throwing on anything other than static messages.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gaearon: It does; this is a %s param so you can put whatever you want there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I copy and pasted this from Stack. I'll change it in both places to use multiple invariants instead.

That way the messages are extracted by the error code transform.
@acdlite acdlite merged commit 5cfff87 into facebook:master Feb 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants