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

Add test coverage for StreamActions export #1023

Merged

Conversation

seanpdoyle
Copy link
Contributor

According to the official documentation, applications that need to extend StreamActions should be importing it directly from the module instead of accessing it through window.Turbo.StreamActions.

This commit adds test coverage to exercise the corresponding import. It also re-arranges the export to explicitly occur in the @hotwired/turbo module itself, instead of being transitively exported as part of the @hotwired/turbo/core module.

@seanpdoyle seanpdoyle mentioned this pull request Oct 8, 2023
2 tasks
seanpdoyle added a commit to seanpdoyle/turbo that referenced this pull request Oct 8, 2023
@seanpdoyle seanpdoyle force-pushed the export-stream-actions-test-coverage branch 2 times, most recently from 138b9c4 to d88e99c Compare October 23, 2023 14:26
src/index.js Outdated
@@ -10,3 +10,4 @@ Turbo.start()
export * from "./core"
Copy link
Collaborator

@afcapel afcapel Oct 23, 2023

Choose a reason for hiding this comment

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

After the last push, isn't this export already exporting StreamActions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, I've reduced this diff to test coverage only.

According to the [official documentation][], applications that need to
extend `StreamActions` should be importing it directly from the module
instead of accessing it through `window.Turbo.StreamActions`.

This commit adds test coverage to exercise the corresponding `import`.
It also re-arranges the `export` to explicitly occur in the
`@hotwired/turbo` module itself, instead of being transitively exported
as part of the `@hotwired/turbo/core` module.

[official documentation]: https://turbo.hotwired.dev/handbook/streams#custom-actions
@seanpdoyle seanpdoyle force-pushed the export-stream-actions-test-coverage branch from d88e99c to f8c15f7 Compare October 23, 2023 14:38
@afcapel afcapel merged commit 68bec03 into hotwired:main Oct 23, 2023
@seanpdoyle seanpdoyle deleted the export-stream-actions-test-coverage branch October 23, 2023 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants