From the course: Building Modern Projects with React

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Testing styled-components

Testing styled-components

From the course: Building Modern Projects with React

Start my 1-month free trial

Testing styled-components

- Last but not least, we're going to move on to the subject of testing styled components. Now the method for this one is generally pretty simple. We don't exactly test our full styled components. The only thing that we can really test in our styled components is the logic we put inside them. For example when we use the created at property on a to do item, to decide whether or not to display a red border at the bottom in the list. So what we should do in this case, in order to be able to test this logic efficiently, is pull this logic out into its own function. So what we going to do, is say export const, get border style for date, or something like that equals. Then we going to say starting date, and current date. And this is going to be a slightly modified version of what we did down here. So we going to say, starting date is greater than, new date, current date, minus eight million, six hundred forty thousand, which…

Contents