Skip to content

Conversation

simfeld
Copy link
Contributor

@simfeld simfeld commented Feb 10, 2021

No description provided.

@simfeld simfeld requested a review from BacLuc February 10, 2021 21:49
await wrapper.find('button').trigger('click')
expect(document.body).toMatchSnapshot('pickeropen')
expect(wrapper).toMatchSnapshot('pickeropen')
wrapper.destroy()
Copy link
Member

@carlobeltrame carlobeltrame Feb 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ist wrapper.destroy() in jedem Test nötig der attachTo: document.body verwendet?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say so. The documentation says (https://vue-test-utils.vuejs.org/api/options.html#attachto):

When attaching to the DOM, you should call wrapper.destroy() at the end of your test to remove the rendered elements from the document and destroy the component instance.

However, it seems that in other tests using attachTo: document.body there are currently no side-effects of not calling destroy. But I think we should do it anyway.

wrapper.destroy()
})

test('updates v-model when the value changes', async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weshalb kommt dieser Test ohne data-app aus?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The picker is never opened in this test (and others), thus we don't need a <div data-app> where Vuetify can attach the picker to.

class="v-slider__thumb grey lighten-2"
/>
</div>
<div data-app>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seltsam dass sich die Formatierung so stark unterscheidet, nur weil jetzt <body> nicht mehr da ist... Aber okay solange es nicht ständig hin- und her ändert.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect that most of the formatting changes arise from changing expect(document.body).toMatchSnapshot('pickeropen') to expect(wrapper).toMatchSnapshot('pickeropen').

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because not the jest-serializer-vue-tjw is used if you pass document.body to match the snapshot.

>
<input
disabled="disabled"
id="input-26"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here you see the id, which would be removed if jest-serializer-vue-tjw was used.

@simfeld simfeld merged commit 9886460 into ecamp:devel Feb 14, 2021
@simfeld simfeld deleted the picker-snapshots-data-app branch February 14, 2021 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants