Skip to content
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

v-html icw .is() broken since beta18 #743

Closed
aphofstede opened this issue Jun 20, 2018 · 1 comment
Closed

v-html icw .is() broken since beta18 #743

aphofstede opened this issue Jun 20, 2018 · 1 comment
Labels

Comments

@aphofstede
Copy link

aphofstede commented Jun 20, 2018

Version

1.0.0-beta.18

Reproduction link

https://codesandbox.io/s/vx48ovm23

Steps to reproduce

Create a component that uses v-html directive and test that it .is() the right element type if the v-if directive evaluates to true

What is expected?

is('div') returns true

What is actually happening?

is('div') returns false

@eddyerburgh
Copy link
Member

A quick fix is to use $forceUpdate to re render after you call setProps:

wrapper.setProps({ propA: true })
wrapper.vm.$forceUpdate()

This was caused here—https://github.com/vuejs/vue-test-utils/pull/586/files#diff-68ebb4dd9f4503e2b26a1b1ac98d4fa2L60. Previously we were creating new root objects from propsData before passing it to the component.

The problem now is that when setProps reassigns the same object, the property getter returns early because it thinks the object isn't changing, so none of the dependencies are notified.

I think the best solution would be to call $forceUpdate if the prop that setProps is setting strictly equals the existing prop.

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

No branches or pull requests

2 participants