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

Framework: Migrate "lib/accept" to single test runner #4503

Merged
merged 4 commits into from
Apr 5, 2016

Conversation

aduth
Copy link
Contributor

@aduth aduth commented Apr 4, 2016

Related: #3942

This pull request seeks to migrate tests for lib/accept to the single test runner. It also includes revisions to the i18n mixin to better accommodate test contexts.

Implementation notes:

translate stubbing has been swapped with the recently-added localize higher-order component. This alone was not sufficient to replace the existing translate stub, as the i18n module errors when trying to call translate before Jed has been initialized. To accommodate this, if a translate attempt is made before Jed is initialized, an empty Jed instance is created on-demand (23aed07). This should not affect existing browser usage as i18n is initialized during boot, but will simplify testing (avoiding need for explicit i18n initialization).

Testing instructions:

Verify both that Mocha tests pass, and that no regressions occur in accept usage. An example of accept is the prompt which occurs when trying to delete media from your post editor media library.

/cc @rralian , @gziolo

@aduth aduth added Framework [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. i18n labels Apr 4, 2016
@gziolo gziolo added this to the Framework: Single test runner milestone Apr 4, 2016
confirmButtonText: React.PropTypes.string,
cancelButtonText: React.PropTypes.string,
translate: PropTypes.func,
message: PropTypes.node,
Copy link
Member

Choose a reason for hiding this comment

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

I didn't know there is node type :P Great to know 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't know there is node type :P Great to know 👍

As the original author of this component, neither did I at the time apparently 😆

@gziolo
Copy link
Member

gziolo commented Apr 5, 2016

Really great improvement. Tests works as expected and code looks nice. I would mark it as Ready to Merge, but I don't feel confident enough to accept 18n lib change.

@aduth
Copy link
Contributor Author

aduth commented Apr 5, 2016

@gziolo : Thanks for the feedback. I rebased and (force-)pushed some revisions to how I had tackled the i18n problem. Rather than auto-initializing in the case that a translate attempt is made before initialization, I created a separate helper in test/helpers/use-i18n for initializing i18n before tests run.

Let me know whether you think this is a better approach.

@@ -97,6 +97,7 @@ node_modules: package.json | node-version
test: build
@npm run test-client
@npm run test-server
@npm run test-tests
Copy link
Member

Choose a reason for hiding this comment

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

yeah, we missed that one 👍

@gziolo gziolo added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Apr 5, 2016
@gziolo
Copy link
Member

gziolo commented Apr 5, 2016

It looks great, I should run it in the browser. Give me couple of minutes :D

@gziolo gziolo added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] Ready to Merge labels Apr 5, 2016
@gziolo
Copy link
Member

gziolo commented Apr 5, 2016

It also works as advertised :shipit:

I created a separate helper in test/helpers/use-i18n for initializing i18n before tests run.

I think this is the best possible approach for all existing tests 👍

@gziolo gziolo added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Apr 5, 2016
@aduth aduth force-pushed the update/accept-single-test-runner branch from 5223896 to 8893710 Compare April 5, 2016 15:34
@aduth aduth merged commit 0009e41 into master Apr 5, 2016
@aduth aduth deleted the update/accept-single-test-runner branch April 5, 2016 15:38
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.

3 participants