-
Notifications
You must be signed in to change notification settings - Fork 109
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
Vue 3: about rerender api design #198
Comments
Hi! Thanks for your message. Looks like you're right, I overlooked this bit: https://github.com/testing-library/vue-testing-library/pull/173/files#diff-25bf86bba97788343267cf1a217702b4825b65b411e7697b0daa7576a5eb79ecR23-R25
That being said:
Moving from Vue 2 support to Vue 3 might yield different behaviors, so consistency is not assured. I understand you want a consistent API, but here we're trying to find the middle ground between vue test utils and testing library family. Also, if you need for some reason to update props, it'd probably be better if you test the component that's doing the updating to ensure that the props are being updated correctly. |
Thanks for your reply I found an API for updateProps on the master version updateprops is a nice API from a code intent point of view What was the reason for its removal? A reasonable design scenario for rerender might be: Keep the previous Wrapper instance and only update it Of course, from a code implementation point of view, it's much easier to destroy and then create What do you think of the reasonable behavior of rereader? |
Yep. I think we should:
That being said, (2) should not be that common because people should really just render the component again manually. We changed names to align with other Testing Library solutions, which feature a |
thank you. I see. To keep the interface consistent If rerender only has actions to modify props then we only need to call wrapper.setprops internally As you said, the second point is not commonly used but is something to consider (this is a complication from rerender naming, people will use it to update other properties) I don't know any other testing library render behavior is what looks like |
This is what React Testing Lib does: https://github.com/testing-library/react-testing-library/blob/master/src/pure.js#L81-L82 they pass the whole component (with JSX) |
(btw, I removed the |
Been so caught up with work that I missed this too. lol. So for clarity (and people are free to disagree with me on this), I intentionally wrote the
I think (and I could be wrong) that some of the push back to the new API is because implementation from VTU leaked out into VTL. Instead of starting out with a literal I think if we're going to use |
Thanks for getting back to this! I'll reread the whole thing to see what we can come up with 👍 However, re this
This is the test that made me rollback changes in our |
Didn't see this. That's actually super helpful in understanding what's going on, so thanks a ton for pointing that out. I'll have to rethink how I think about |
This discussion has been silent for a while, but in case there is still some debate about the future of the I'm part of a team developing a design system and the same components are developed for multiple frameworks. I've been hoping that we could reuse the same tests for the same components with only the input component defined accordingly for each fw. The idea so far only broke when it came to the |
Hi, I'm a little confused when using the rerender API
I wanted to update props, but then I realized that in the next release, I needed to call rerender api
However, I looked at the implementation of rerender and saw that the component instance was re-destroyed and then re-created
But my test requirement is to simulate that the user only updated props
For example, I did this earlier by calling the wrapper. setProps API for vue-test-utils-next
Now the new rerender behaves substantially differently than setProps
The former is destroyed to re-create components based on the new props
The latter is to change the props on a component that has been created previously
I need to have a consistent API and setProps behavior
The text was updated successfully, but these errors were encountered: