Chce napisac test jednostkowy który sprawdza czy hatWrapper dostał odpowiednią klasę.
Niestety otrzymuje taki komunikat:
expect(received).toEqual(expected) // deep equality
Expected: true
Received: false
a Moj test wygląda tak:
test("should add class", () => {
const hat = new Hat(true),
hatWrapper = document.createElement("div");
hat.prevAnimationAPosY = 300;
hat.prevPosY=500;
hat.scrollAnimation(hatWrapper,'400','200')
window.scrollTo(0, 1000);
expect(hatWrapper.classList.contains('scroll_down')).toEqual(true);
});
moja klasa
https://codepen.io/olivier-mazur/pen/jOZdEQp?editors=1010