Skip to content

Commit 47c99aa

Browse files
committed
Move props to propsData to sync with vue-test-utils
1 parent 356d624 commit 47c99aa

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ The `render` function takes up to 3 parameters and returns an object with some h
116116

117117
1. Component - the Vue component to be tested.
118118
2. RenderOptions - an object containing additional information to be passed to @vue/test-utils mount. This can be:
119-
* props - The component props to be passed to TestComponent
120119
* store - The object definition of a Vuex store, if present `render` will configure a Vuex store and pass to mount.
121120
* routes - A set of routes, if present render will configure VueRouter and pass to mount.
121+
All additional render options are passed to the vue-test-utils mount function in its options.
122122
3. configurationCb - A callback to be called passing the Vue instance when created. This allows 3rd party plugins to be installed prior to mount.
123123

124124
### fireEvent

src/index.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,18 @@ function render (TestComponent, {
3939
configurationCb(localVue)
4040
}
4141

42-
const { props, ...rest } = mountOptions
42+
if (!mountOptions.propsData && !!mountOptions.props) {
43+
mountOptions.propsData = mountOptions.props
44+
delete mountOptions.props
45+
}
46+
4347
const wrapper = mount(TestComponent, {
4448
localVue,
4549
router,
4650
store: vuexStore,
47-
propsData: { ...props },
4851
attachToDocument: true,
4952
sync: false,
50-
...rest
53+
...mountOptions
5154
})
5255

5356
mountedWrappers.add(wrapper)

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -1873,10 +1873,10 @@ eslint-visitor-keys@^1.0.0:
18731873
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d"
18741874
integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==
18751875

1876-
eslint@^5.11.0:
1877-
version "5.11.0"
1878-
resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.11.0.tgz#51a0e70f137a425fe044cd48273b96f28a774b1f"
1879-
integrity sha512-gbEg0ttToZPkZUv2yYjpipxuYrv/9aSSmgM4V6GkiO3u04QosHYBtduUCqLEulEg3YvNDAkk3OWzyQJ/heZ3Nw==
1876+
eslint@^5.11.1:
1877+
version "5.11.1"
1878+
resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.11.1.tgz#8deda83db9f354bf9d3f53f9677af7e0e13eadda"
1879+
integrity sha512-gOKhM8JwlFOc2acbOrkYR05NW8M6DCMSvfcJiBB5NDxRE1gv8kbvxKaC9u69e6ZGEMWXcswA/7eKR229cEIpvg==
18801880
dependencies:
18811881
"@babel/code-frame" "^7.0.0"
18821882
ajv "^6.5.3"

0 commit comments

Comments
 (0)