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

Options instead of props as second argument to render #1

Closed
EmilTholin opened this issue May 3, 2019 · 3 comments
Closed

Options instead of props as second argument to render #1

EmilTholin opened this issue May 3, 2019 · 3 comments

Comments

@EmilTholin
Copy link
Contributor

Thank you for you hard work on svelte-testing-library! I can't wait to test my components with this!

What are your thoughts about changing the second argument of render to options instead of props? This would allow the user of this great library to tailor all the other component options that are available to their liking, most notably hydrate.

- export const render = (Component, props) => {
+ export const render = (Component, options) => {
    const container = document.body.appendChild(document.createElement('div'))

    const rendered = new Component({
+     ...options,
      target: container,
-     props,
    })
    // ...
  }
const { getByText } = render(App, {
  props: { name: "world" },
  hydrate: true
});
@benmonro
Copy link
Member

benmonro commented May 3, 2019

I dig it, @EmilTholin. makes sense to me.

I noticed you have a library as well. I had googled 'svelte-testing-library' before starting this repo, and didn't see anything, so just dove in. Then I noticed that you and another person have started work on these. Feel free to submit PRs!

-Ben

@EmilTholin
Copy link
Contributor Author

Great!

It might be worth contacting Wendell to see if he wants to join forces on this repository. It would be a shame if we spread our efforts on three almost identical projects, and the offical testing-library version didn't get the svelte-testing-library name.

@benmonro
Copy link
Member

benmonro commented May 3, 2019

I did reach out to Wendell but haven't heard back, and I'd love to join forces and agree 💯

@benmonro benmonro closed this as completed May 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants