Skip to content

setProps doesn't allow setting attributes #1009

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

Closed
rayax86 opened this issue Oct 22, 2018 · 2 comments
Closed

setProps doesn't allow setting attributes #1009

rayax86 opened this issue Oct 22, 2018 · 2 comments

Comments

@rayax86
Copy link

rayax86 commented Oct 22, 2018

Version

1.0.0-beta.25

Reproduction link

https://vue-test-utils.vuejs.org/api/wrapper/#setprops-props

Steps to reproduce

Call setProps with an object with attributes not defined in the mounted component's props option.

What is expected?

Undefined attributes will be parsed as $attrs in the component, just like what will happen when providing propsData when mounting the component.

What is actually happening?

The following error pops up:

[vue-test-utils]: wrapper.setProps() called with [undefined attribute name] property which is not defined on the component

As Vue 2.4 adds support for $attrs, this inconsistency in vue-test-utils would be annoying when testing a component that uses $attrs. We had to re-mount the component which is not required in actual code, as $attrs is reactive.

@abilicz
Copy link
Contributor

abilicz commented Nov 18, 2018

I have created a pull request for this #1029

@eddyerburgh
Copy link
Member

This has been added in #1029 and will be released in beta.26.

Thanks @abilicz!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants