Giter Site home page Giter Site logo

Comments (9)

gnapse avatar gnapse commented on May 27, 2024 1

Makes sense. Are you up to contributing this improvement?

from jest-dom.

gnapse avatar gnapse commented on May 27, 2024 1

I'm giving it a try in #563. One particularly contentious aspect of it is that I had to tread lightly with an existing feature of .toHaveClass: the ability to match the full class exactly when passing toHaveClass('…', {exact: true}). In the end, I opted for disabling regexp support when enabling this option, since it does not make sense to make it work with regular expressions, which are inherently about checking the class names partially and not exactly.

from jest-dom.

gnapse avatar gnapse commented on May 27, 2024 1

Thanks for the reminder. Will try to get it merged and released today.

from jest-dom.

Namnika avatar Namnika commented on May 27, 2024

I also faced the same thing now:

expect(audioBtn).toHaveClass(/audio-btn/i)

and get this:

expect(element).toHaveClass(expected)
At least one expected class must be provided.

from jest-dom.

vacas avatar vacas commented on May 27, 2024

Hello! I saw the PR is approved by one, but the branch seems to be out of date. Is this being prioritized still? Do you need any support here, by any chance? This would be great for a test I've been just trying to write now.

Thanks!

from jest-dom.

github-actions avatar github-actions commented on May 27, 2024

🎉 This issue has been resolved in version 6.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

from jest-dom.

vacas avatar vacas commented on May 27, 2024

Hello!

@gnapse, thanks for tackling this! I really appreciate it 😄

So, I just tried this out (i.e. expect(el).toHaveClass(/disabled/) with a list of classes label select has-value root search disabled) and I'm coming across the following error: At least one expected class must be provided., but if I do expect(el).toHaveClass('disabled'), the tests do pass... am I missing something here?

from jest-dom.

vacas avatar vacas commented on May 27, 2024

Also, I just tried expect(el).toHaveClass(/disabled/, 'root') on the same example as above, and I'm getting str.split is not a function, but if I do expect(el).toHaveClass('root', /disabled/), all the tests pass - could there a check on the first argument of toHaveClass that might prevent it to be a Regex?

from jest-dom.

vacas avatar vacas commented on May 27, 2024

@gnapse, just wanted to follow up on this. Let me know if there's anything I can do to help here, yes?

from jest-dom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.