Skip to content

Commit

Permalink
feat: add props in mountComponent (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
vaibhavsingh97 committed Apr 20, 2023
1 parent 348afb8 commit 10337b9
Show file tree
Hide file tree
Showing 5 changed files with 551 additions and 166 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ writing Vue component tests.
**Parameters:**
- `componentPath` – location of the component file (`.jsx`) to be mounted
- `options` – this can include:
- `props` - properties to be passed to the Vue component, this will be serialized to JSON
- `plugins`: if needed, a store (VueX or Pinia) and a router can be loaded together with the component
- `mocks`: this can be a list of url calls that can be mocked (will be passed to [sinon](https://sinonjs.org/) automatically); at the moment only [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) calls can be mocked, but XHR support will be added soon.
- `callback` – an optional callback function which will be called with the component element
Expand All @@ -105,6 +106,14 @@ writing Vue component tests.
const component = await browser.mountComponent('/src/components/Form.vue')
```

```js
const component = await browser.mountComponent('/src/components/Welcome.vue', {
props: {
username: 'John Doe'
}
})
```

```js
const component = await browser.mountComponent('/src/components/Form.vue', {
plugins: {
Expand Down
Loading

0 comments on commit 10337b9

Please sign in to comment.