-
-
Notifications
You must be signed in to change notification settings - Fork 538
fix(vue) make compatible with vue 2 & 3 #609
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
Conversation
- add typings for vue3 - move computed items to data because they don't change - expose recalculate - add props to be more vue-y - add type checking - add docs to props - update package.json for vue3 whatnot
- remove excess methods
|
@Grsmto any reason to hold or not reviewing this? I was about to make a PR myself, but this covers it and add some extra good stuff namely the props API. @MichaelFedora if you allow me to review, the only things I would tweak:
|
- also add descriptive type comments
|
Hey @renatodeleao ! I honestly have no idea what I'm doing with the testing libraries (it's my weakest skill), I simply copied some stuff from #578 . If you want to fork my branch and make your own PR I'll gladly close in favor of yours? I adjusted the reactive data definitions and added some more type comments. I've tested in Vue2 by using this exact element in a professional project (along with adding |
Hey @renatodeleao I'm currently on vacations but I'll be able to review this soon. I would be happy to let you review it since I'm not using Vue at all I'm probably not the best person to do it anyway! |
|
@Grsmto no problem, enjoy your vacations! 🏖️ I'm a bit short on time, but I'll try to squeeze this into the work agenda. |
|
@renatodeleao Any update on this? |
|
@anburocky3 if you do need this ASAP I do recommend just copying the file and using it locally, it's what I've been doing for the past few months. |
It is using vue2 right? I'm looking for latest vue3. |
|
It should work in both. |
i could not setup the project using latest node 16, sharp package failed to build because of some native bindings. Not sure if related with my m1, but though i would add this. Tested with 12 and 14 and installed fine.
We can now run same tests as vue 2.6, 2.7 (composition-apo) and 3.x from a single file test file. Note we still need to adjust the mountingOptions signature because vue-test-utils has some breaking changes from 1 to 2. If tests get better (more complext) an isomorphic wrapper around mount/shallowMount should be added to test-utils/.js. - adds swap-vue.js script and vue-demi: this is straight from vuelidate codebase - adds aliased vue versions of core, compilers and vue-jest. swap-vue and vue demi will set the proper versions beforehand - using isVue3 flag from vue-demi we conditionally re-export @vue-test/utils from the appropriate version - called html() before snapshots, because jest-serializer-vue is not yet compatible with vue3 eddyerburgh/jest-serializer-vue#56 -
- it's a breaking change to remove it, because $refs are exposed and consumers might be expecting its presence - this.$attrs in vue3 contains class, style and event listeners altogether. Also, Simplebar.getOptions only works it NamedNodeMap not a plain object like $attrs: and now that tests are working you could actually see it failing before this fix.
Simplebar was not unMount when component is destroyed, which in conditionally loading scenarios potentially could lead to memory/event leaks.
|
Folks update: I've patched this PR with isomorphic testing and a couple of fixes to make this work on both vue versions! I'm sorry for the delay and the kind of ghosting but life happened and I had a baby 🎉... so didn't have much free time for OSS... neither have now but got some employer sponsor time for this so here it is! @MichaelFedora didn't push directly to your fork because don't have write access but merge the PR when you can. Then you might have to sync this with Cheers everyone! |
and original 'test' to 'jest', this way we keep ci happy, since it's expecting this name
it's not necessary, i've added while bashing my head against the wall trying to make this work
feat: isomorphic testing for vue 2 and 3 and relevant fixes
|
Merged and congratulations @renatodeleao ! 🎉 The |
|
Thanks for the work on this! Let me know when you think this is ready for merge and I will happily do it. |
|
@MichaelFedora thanks for the merge!
Fetching your branch, and running When you're at it, one last favour: Lines 6 to 8 in 62103fe
remove these 3 lines, after the
Why? Testing is running fine locally and on CI. |
- fix missing semicolons and set SimpleBar to undefined instead of null - update yarn.lock - remove "engines" from package.json
I was trying to avoid this with the 18k dependencies but, done 😅
Done!
Yeah I was saying this if it kept failing, but seems to be fine! |
|
@Grsmto Seems we're good to go! |
|
@Grsmto When will |
|
This has been release in simplebar-vue@1.7.0. |
|
Did something break that caused this to be reverted? |
|
Yup, see #630 which is another attempt. |
I was able to make it compatible with both versions, except for typings. I don't know how to run your tests / they were not able to be run, but it theoretically should work. If you could run them that would be great!
I'm also not entirely sure the typings will work but they should.
Changes
datajust be assigned inmounted()because they don't change and don't need reactivity$emits instead of a weird pass-through$attrsinstead of$refs.element.attributesor$el.attributesSupersedes #578 , closes #557, #600, and #588.