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

Updated method not called #624

Closed
tangjinzhou opened this issue May 18, 2018 · 1 comment
Closed

Updated method not called #624

tangjinzhou opened this issue May 18, 2018 · 1 comment

Comments

@tangjinzhou
Copy link

tangjinzhou commented May 18, 2018

Version

1.0.0-beta.16

Reproduction link

https://github.com/vueComponent/ant-design

Steps to reproduce

  • npm i
  • npm run test

What is expected?

After setProps, updated method called at Modal.test.js

What is actually happening?

After setProps, updated method not called at Modal.test.js

@eddyerburgh
Copy link
Member

eddyerburgh commented May 18, 2018

Thanks, this is a duplicate of #455.

The reason for this is that we now set the instance watcher to sync, which means the update event is never fired. This is a serious issue that I'm investigating, but it won't have a quick fix. For the moment, you will need to test by setting sync to false and using Vue.nextTick:

it('calls onUpdate when component updates', (done) => {
  const onUpdate = jest.fn()

  const wrapper = mount(TestComponent, {
    sync: false,
    propsData: {
      onUpdate
    }
  })

  Vue.nextTick(() => {
    expect(onUpdate).toHaveBeenCalled()
    done()
  })
})

I'm closing in favor of the existing issue.

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

No branches or pull requests

2 participants