1

I'm trying to test the output of Mithril.js components to programmatically verify that they look how they are intended to. What would be the best way to go about doing this? I'm working with the Jasmine testing framework.

I've been looking for a library that could take a Mithril component and easily verify that it has some element with so many of some other element as the children, and they have some set of properties. Essentially, I'm looking for something like Enzyme that works with Mithril. Of course, I want something as decoupled as possible from the implementation of the code.

I've looked into the library mithril-query, which verifies the existence of elements through CSS selectors, but I've had issues with it not working with compound selectors, and the syntax isn't visually intuitive. I would also just like to know if there are any other options available.

GameRoom
  • 15
  • 1
  • 4
  • Hi, author of mithril-query here. Can you get in more detail about the problems you face with mithril-query? Maybe there is room for improvement on my side. – Stephan Hoyer Oct 06 '17 at 09:23
  • I was using it a while ago at an old job with code that I no longer have access to, but I at least remember that the main issue I had was that multiple attribute selectors did not work. `input[name=X][value=Y]` does not work correctly, for instance. – GameRoom Oct 07 '17 at 16:23

1 Answers1

0

You could try mithril-node-render combined with your favorite HTML assertion tool.

Tivac
  • 2,553
  • 18
  • 21