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

Migrate initial render tests #559

Merged
merged 1 commit into from
Jun 27, 2017
Merged

Migrate initial render tests #559

merged 1 commit into from
Jun 27, 2017

Conversation

chadhietala
Copy link
Member

@chadhietala chadhietala commented Jun 22, 2017

What Is Going On Here

This PR does several things to ensure that when we run the VM in "serialize mode" on the server that we forgo some prop setting and namespace creation as they do not have any relevance on the server. This is done by setting up 2 environments in the tests; one for the server and one for the client. The server Environment uses simple-dom and the NodeTreeContruction class which allow us to safely produce the serialized HTML format for rehydration. The client environment works exactly like the Environment that is used today in Glimmer and Ember applications.

The test harness works by doing the SSR first, verifying the output is correct and then sets the serialized HTML as the starting point for the client-side tests. This allows for us to test the entire rehydration flow, along with cases where the server output and the client side construction do not match.

To make sure we have more comprehensive coverage this PR consolidates all the tests from initial-render-test.js into the new test harness. Also since the new test harness was very similar to content-test.js those are also consolidated here. These tests should be used as an example of how to migrate the rest of the tests.

@chadhietala chadhietala force-pushed the more-rehydration-tests branch from 16cf5b2 to 05b286b Compare June 27, 2017 17:28
@chadhietala chadhietala changed the title [WIP] Migrate initial render tests Migrate initial render tests Jun 27, 2017
@chadhietala chadhietala force-pushed the more-rehydration-tests branch 2 times, most recently from 72ae460 to 23c23d2 Compare June 27, 2017 20:49
This PR does several things to ensure that when we run the VM in "serialize mode" on the server that we forgo some prop setting and namespace creation as they do not have any relevance on the server. This is done by setting up 2 environments in the tests; one for the server and one for the client. The server `Environment` uses `simple-dom` and the `NodeTreeContruction` class which allow us to safely produce the serialized HTML format for rehydration. The client environment works exactly like the `Environment` that is used today in Glimmer and Ember applications.

The test harness works by doing the SSR first, verifying the output is correct and then sets the serialized HTML as the starting point for the client-side tests. This allows for us to test the entire rehydration flow, along with cases where the server output and the client side construction do not match.

To make sure we have more comprehensive coverage this PR consolidates all the tests from [initial-render-test.js](https://github.com/glimmerjs/glimmer-vm/blob/master/packages/@glimmer/runtime/test/initial-render-test.ts) into the new test harness. Also since the new test harness was very similar to [content-test.js](https://github.com/glimmerjs/glimmer-vm/blob/master/packages/@glimmer/runtime/test/rendering/content-test.ts) those are also consolidated here. These tests should be used as an example of how to migrate the rest of the tests.
@chadhietala chadhietala force-pushed the more-rehydration-tests branch from 23c23d2 to 2f94eb8 Compare June 27, 2017 20:55
@rwjblue rwjblue merged commit af92942 into master Jun 27, 2017
@rwjblue rwjblue deleted the more-rehydration-tests branch June 27, 2017 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants