Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Sprint-3/quote-generator/quotes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ There are some Tests in this file that will help you work out if your code is wo

const path = require("path");
const { JSDOM } = require("jsdom");
const { default: userEvent } = require("@testing-library/user-event");

let page = null;

Expand Down Expand Up @@ -61,14 +60,14 @@ describe("Quote generator", () => {
expect(authorP).toHaveTextContent("Albert Einstein");
expect(newQuoteBtn).toHaveTextContent("New quote");

userEvent.click(newQuoteBtn);
newQuoteBtn.click();

expect(quoteP).toHaveTextContent(
"I've learned that people will forget what you said, people will forget what you did, but people will never forget how you made them feel."
);
expect(authorP).toHaveTextContent("Maya Angelou");

userEvent.click(newQuoteBtn);
newQuoteBtn.click();

expect(quoteP).toHaveTextContent(
"I have learned over the years that when one's mind is made up, this diminishes fear."
Expand Down
1 change: 0 additions & 1 deletion Sprint-3/reading-list/script.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const path = require("path");
const { JSDOM } = require("jsdom");
const { default: userEvent } = require("@testing-library/user-event");

let page = null;

Expand Down
27 changes: 13 additions & 14 deletions Sprint-3/slideshow/slideshow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ There are some Tests in this file that will help you work out if your code is wo

const path = require("path");
const { JSDOM } = require("jsdom");
const { default: userEvent } = require("@testing-library/user-event");

let page = null;

Expand Down Expand Up @@ -59,7 +58,7 @@ describe("Level 1 challenge", () => {

expect(image).toHaveAttribute("src", images[0]);

userEvent.click(forwardBtn);
forwardBtn.click();

expect(image).toHaveAttribute("src", images[1]);
});
Expand All @@ -73,8 +72,8 @@ describe("Level 1 challenge", () => {
const image = page.window.document.querySelector("#carousel-img");
const forwardBtn = page.window.document.querySelector("#forward-btn");

userEvent.click(forwardBtn);
userEvent.click(forwardBtn);
forwardBtn.click();
forwardBtn.click();

expect(image).toHaveAttribute("src", images[2]);
});
Expand All @@ -90,7 +89,7 @@ describe("Level 1 challenge", () => {

expect(image).toHaveAttribute("src", images[0]);

userEvent.click(backwardBtn);
backwardBtn.click();

expect(image).toHaveAttribute("src", images[2]);
});
Expand All @@ -105,8 +104,8 @@ describe("Level 1 challenge", () => {
const backwardBtn = page.window.document.querySelector("#backward-btn");
expect(image).toHaveAttribute("src", images[0]);

userEvent.click(backwardBtn);
userEvent.click(backwardBtn);
backwardBtn.click();
backwardBtn.click();

expect(image).toHaveAttribute("src", images[1]);
});
Expand All @@ -122,9 +121,9 @@ describe("Level 1 challenge", () => {

expect(image).toHaveAttribute("src", images[0]);

userEvent.click(forwardBtn);
userEvent.click(forwardBtn);
userEvent.click(forwardBtn);
forwardBtn.click();
forwardBtn.click();
forwardBtn.click();

expect(image).toHaveAttribute("src", images[0]);
});
Expand All @@ -150,7 +149,7 @@ describe("Level 2 challenge", () => {

expect(image).toHaveAttribute("src", images[0]);

userEvent.click(autoForwardBtn);
autoForwardBtn.click();

expect(autoForwardBtn).toBeDisabled();
expect(autoBackBtn).toBeDisabled();
Expand All @@ -177,7 +176,7 @@ describe("Level 2 challenge", () => {

expect(image).toHaveAttribute("src", images[0]);

userEvent.click(autoBackBtn);
autoBackBtn.click();

expect(autoForwardBtn).toBeDisabled();
expect(autoBackBtn).toBeDisabled();
Expand Down Expand Up @@ -205,7 +204,7 @@ describe("Level 2 challenge", () => {

expect(image).toHaveAttribute("src", images[0]);

userEvent.click(autoForwardBtn);
autoForwardBtn.click();

expect(autoForwardBtn).toBeDisabled();
expect(autoBackBtn).toBeDisabled();
Expand All @@ -216,7 +215,7 @@ describe("Level 2 challenge", () => {
jest.advanceTimersByTime(interval);
expect(image).toHaveAttribute("src", images[2]);

userEvent.click(stopBtn);
stopBtn.click();

expect(autoForwardBtn).toBeEnabled();
expect(autoBackBtn).toBeEnabled();
Expand Down