Skip to content

Support multiple classes in hasClass #118

Closed
@lmiller1990

Description

@lmiller1990

Hi,

I noticed that hasClass() only works for single word classes. For example, I did something like:

<template>
  <div :class="[ todo.isComplete ? 'complete todo' : incomplete todo']">
    Text
  </div>
</template>

And because hasClass() does

return !!(this.element && this.element.classList.contains(className))

You cannot find multiword classes. This was a little inconvenient since I mainly use semantic-ui, which uses longer multiword names like ui eight wide compact grid. Being able to assert the full class name makes my tests more understandable.

My proposal is to all hasClass to work with multiword classes. This seems like a pretty easy change and I'd like to tackle it if the maintainer(s) are okay with it.

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