2

I'm trying to test that v-calendar drew successfuly with Jest.

First, I tried to check rendered page's html if it contains v-calendar's elements like '.vc-pane-container'.

But when i try to get rendered Page Html code, they only returned like this.

<v-calendar 
  is-expanded="" 
  title-position="left" 
  locale="[object Object]">
</v-calendar>

my expectation retutn value

Sadly, this doesn't match with my expection. Therefore also my TC doesn't work like my purpose.

I wonder to know is there any other way to check v-calendar drawed well.


Here's my code. Thanks.

[template.vue]--------------------
<template>
  <div class="calendar-wrapper">
    <v-calendar
        is-expanded
        title-position="left"
        :attributes="attrs"
        :locale="locale"/>
  </div>
</template>


[test.js] -------------------------
test('Is v-calendar drew succesful', async () => {
    const wrapper = mount(Calendar);

    await wrapper.setData({
      locale: { id: 'en' },
      attrs: [{
        key: 'today',
        highlight: {
          class: 'date-circle',
          contentClass: 'date-text',
        },
        dates: new Date(),
      }],
    });

    expect(wrapper.html()).toContain('.vc-container');
  });
tmein
  • 21
  • 2

0 Answers0