Skip to content

Options instead of props as second argument to render  #1

Closed
@EmilTholin

Description

@EmilTholin

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
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions