Skip to content

Problem with this.element #62

Closed
Closed
@lusarz

Description

@lusarz

I wanted to use hasClass method this way:
expect(wrapper.hasClass('some-class')).to.be.true
but I've got error:
undefined is not an object (evaluating 'this.element.classList.contains')
while this one:
expect(wrapper.vm.$el.classList.contains('some-class')).to.be.true
works.

I've tried to debug it a bit, and added these lines into hasClass method:
console.log(this.element);
console.log(this.vm.$el);

and I've got output:
LOG: <!---->
LOG: <div class="some-class">...</div>

What do you think? It's ok that element and vm.$el are different?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions