Vue-test-utils: Component references in computed property don't match test

Created on 13 Feb 2019  Â·  2Comments  Â·  Source: vuejs/vue-test-utils

Version

1.0.0-beta.29

Reproduction link

https://codesandbox.io/s/1yy71j858q

Steps to reproduce

  1. Run tests

What is expected?

  1. Test should pass

What is actually happening?

This is difficult to explain, but the test is failing, even though the proper event is being emitted, and it's causing values to change which trigger the computed property to re-run. But the values themselves are incorrect and don't match those in the unit test itself.

    console.log(
      'inside test, dirty/required:',
      wrapper.vm.$v.email.$dirty,
      wrapper.vm.$v.email.required
    );

The results here are true and false as expected, though the computed property shows false and false even after the blur event is emitted.

bug

Most helpful comment

This is a bug with sync mode.

To fix your example, set sync to false:

const wrapper = mount(HelloWorld, { sync: false })

Sync mode will be removed in the next beta version because of these kinds of bugs—see this issue for more details.

This bug will be fixed by removing sync mode (which is already in the dev branch), so I'll close this issue.

All 2 comments

This is a bug with sync mode.

To fix your example, set sync to false:

const wrapper = mount(HelloWorld, { sync: false })

Sync mode will be removed in the next beta version because of these kinds of bugs—see this issue for more details.

This bug will be fixed by removing sync mode (which is already in the dev branch), so I'll close this issue.

Perfect, thank you!

Was this page helpful?
0 / 5 - 0 ratings