React Testing: Conditional className with Shallow Rendering

Share this video with your friends

Send Tweet

Often our components have output that shows differently depending on the props it is given; in this lesson, we go over how to compare the className prop element tree output based on conditional input.

Zachary Klein
Zachary Klein
~ 8 years ago

I don't want to be judgy, but this doesn't strike me as a very illuminating example. I was hoping there might be some support for variable conditions in tests (so the same test could be run with different inputs/expected output). Of course it's no fault of the lesson that this (apparently) isn't possible, but I'm not sure what I learned from this video. :(