-
Notifications
You must be signed in to change notification settings - Fork 668
vue-class-component use causes html() to return empty html comment #73
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
Comments
This looks because I just confirmed this happens if I use |
Try mounting the component with clone set to false: const wrapper = mount(Test, {
clone: false
}) vue-test-utils clones components by default so that it can stub them without affecting the base component object. |
Hey @eddyerburgh, thanks for the suggestion. Unfortunately |
1.0.0-beta.3 has support for extended components. Can you try with the new version and see if it fixes your issue |
Fixed it for me, @eddyerburgh - many thanks! |
Fixed it for me too, thanks all! |
Hey again, I noticed this same problem happening in the latest release, beta.9. I didn't notice this in beta.8. Could anyone take a look? |
same problem in beta.9: let wrapper = mount({
template: `<div>1<tester></tester></div>`,
components: {
tester: {
template: `<div class="tester">test</div>`
}
}
});
console.log(wrapper.html());
// will return:
// <div>1<!--function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }--></div> |
@conkur can you post a minimal reproduction? @74sharlock Thanks for the bug report. I believe this is a different bug. Can you create a new issue? |
@eddyerburgh Thanks for reply. I've created a new issue about that in #329 |
@eddyerburgh Sure, the first comment on this issue contains a reproduction (the |
@conkur I can't reproduce this using your example. Are you able to provide a full minimal reproduction that replicates the bug? |
Sure @eddyerburgh The component:
The spec:
I am using the latest version of vue-class-component ( If I remove |
Sorry, I still can't reproduce with your example. Can you create a repository with a failing example so that I can debug it? |
Same problem here with vue-class-component & vue-property-decoratorafter updating to TS 2.7.1 from 2.6.2. Wired thing is that it works sometimes and sometimes it does not. For example if I remove a @mutation (even if not used) or change its typing (to a more correct one!) toe .html() of the wrapper becomes empty?! |
Are you able to provide a minimal reproduction @tbsvttr ? I've tried to reproduce with TypeScript and in plain JavaScript and have been unsuccessful. Once I have a reproduction (a GitHub repository that shows the bug) I can add a fix for it 😀. |
Also occurring for me :( Getting |
Can someone please provide a GitHub repository with a reproduction. I've tried to reproduce this issue three times but been unable, I'd like to get this fixed but can't fix until I have an example where it's not working! |
I'm getting https://github.com/Skwai/bitext/tree/typescript-vue If there was a definitive guide to using the following together that'd be great, as I was trying to piece it together based on a bunch of other examples I found:
The unit test: |
It looks like vue-cli 3.x scaffolding seems to fix this issue. I might rebase my project off that |
@Skwai Do you know how vue-cli is fixing this issue? |
I still aren't able to reproduce this issue. There have been some updates that mean VueClassComponents are stubbed correctly by I'm going to close this issue, as I've added tests for |
@tbsvttr It looks like it abstracts it away to a |
@Skwai Thank you very much for the hint. I even found out what the "magic" is. vue-cli-service uses vue-jest, but I used jest-vue-preprocessor before. After I replaced the first with the latter one everything is working for me. |
Hello,
I noticed that my single file component which uses
Component
fromvue-class-component
is returning an empty html comment ('<!---->'
) when I printwrapper.html()
.Component:
Mounting in test file:
const wrapper = mount(Test);
When not using
vue-test-utils
, I see the same problem of the empty html comment being returned invm.$el
when I mount the component like so:vm = new Vue(Test).$mount()
However I get the expectedvm.$el
content when I mount the component like this instead:Which I saw in this issue vuejs/vue-class-component#75
Not sure if this issue should be filed to
vue-class-component
instead.Thanks in advance,
Kevin
The text was updated successfully, but these errors were encountered: