vuejs/vue-test-utils

vue 2.7 : test of attribute on a stubbed component - does not work if value is boolean false

johndegey opened this issue · 1 comments

Hello,

I'm using Vue 2.7.14, @testing-library with vue-test-utils 1.3.4
When I try to test an attribute on a stubbed component, if the value is boolean 'false', the attribute is not render in the html, so it can't be tested.

Subject of the issue

test of an attribute for a stubbed component.

Steps to reproduce

https://github.com/johndegey/vite-vitest-vue2
Run test in branch 'stubbing-with-attribute'

Expected behaviour

Test should work when the attribute is a boolean 'false' value.
Expect to see the attribute in the output of the stubbed component.

Actual behaviour

Test fails, the attribute is not present in the output of the stubbed component.

Possible Solution

Alternative : using Number and validate it should only be 0 | 1

Best
John

Hi!

Sounds like dup of #2048?