Skip to content

fix: method should be updated when triggering #622

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

Merged
merged 3 commits into from
May 17, 2018

Conversation

briwa
Copy link
Contributor

@briwa briwa commented May 16, 2018

Potentially fix #615.

I've learned about this bug a while ago before the issue was raised (it happened on my project as well). Here's a small isolated repro link https://jsfiddle.net/3vbnq15z/

I understand that update is deprecated and the test utils are going towards synchronous updates. However I think for trigger it is necessary to update. Let me know what you think about the approach.

I also deleted one test in setMethod spec which is a duplicate.

Thanks.

expect(wrapper.vm.isActive).to.be.true
// Replace the toggle function so that the data supposedly won't change
const toggleActive = () => console.log('overriden')
wrapper.setMethods({ toggleActive })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should trigger toggle active again after you call setMethods, to make sure it's been overwritten

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eddyerburgh My bad, totally missed that part. I've updated the PR. Thanks.

@eddyerburgh
Copy link
Member

Thanks :)

@eddyerburgh eddyerburgh merged commit 3922ab7 into vuejs:dev May 17, 2018
@briwa briwa deleted the fix-setmethod branch May 18, 2018 01:07
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

Successfully merging this pull request may close these issues.

Trigger disregards setMethods and remains referencing the old one
2 participants