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

Using shallow() with vue-class-component - can't get rendered template #137

Open
downace opened this issue Sep 26, 2017 · 1 comment
Open
Labels

Comments

@downace
Copy link

downace commented Sep 26, 2017

Can't get rendered HTML when using shallow:
foo.vue

<template>
  <div>
    <div class="header">
      <h3>{{ title }}</h3>
    </div>
    <div class="body">
      <p>{{ body }}</p>
    </div>
  </div>
</template>
<script lang="ts">
    import Vue from 'vue';
    import Component from 'vue-class-component';
    import { Prop } from 'vue-property-decorator';

    @Component
    export default class Cmp extends Vue {
        @Prop(String)
        title: string;

        @Prop(String)
        body: string;
    }
</script>

foo.spec.ts:

import { shallow } from 'avoriaz';
import Foo from './foo.vue';

describe('foo component', () => {

    it.only('render', () => {
        const wrapper = shallow(Foo, { propsData: { title: 'Foo', body: 'Bar' } });

        console.log(wrapper.element.outerText);
        console.log(wrapper.element.outerHTML);
        console.log(wrapper.html());
    });

});

Output:

undefined
undefined
<!--function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }-->

Maybe I'm doing something wrong?

@eddyerburgh
Copy link
Owner

Sorry, there's a bug with TS at the moment.

I'm not a TS user so it's difficult for me to debug, and I haven't got much time at the moment.

If you'd like to take a look, I'd really appreciate it.

Otherwise, I'll try to fix in a few weeks

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

No branches or pull requests

2 participants