🗹 Fail 🗹 Pass ☒ Refactor
Yes, because we have completed the refactor stage.
🗹 Fail 🗹 Pass 🗹 Refactor
Are these testing stage-indicators of helpful to remind about what we are focusing on?
That brings us to an end of the testing cycle, and we can now cycle back around to the fail stage where we add a new test.
☒ Fail ☐ Pass ☐ Refactor
We want a test failing in such a way that the manageCover.init code will be able to make it pass.
We have been testing what happens when manageCover.init() is initialized. Our focus currently has been on the openCurtain() function.
function openCurtain(cover) {
hide(cover);
const curtain = document.querySelector(".curtain");
curtain.classList.add("slide");
return curtain;
}
We have tested the hide. Now we have the “slide” to test.
- The new test is to be called “slides the curtain when cover is clicked”
- In that test we start by initializing manageCover.
- Then we remove “slide” from the curtain which will be two lines of code:
- One to define a curtain variable,
- and another to remove the “slide” class from the curtain.
- Then we expect that that curtain has the “slide” class.
We deliberately remove “slide” then expect “slide” to be there, to get a failing test. Between those two lines we will do something with manageCover to make the test pass. But not yet. Right now the focus is on having a suitably failing test.