Skip to content

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

Open
@johndegey

Description

@johndegey

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions