Skip to content

setProps doesn't allow setting attributes #1009

Closed
@rayax86

Description

@rayax86

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions