From 71fa218a8f7b7e014738432dadc1497470ae9ed9 Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Fri, 24 Oct 2025 10:12:47 +0100 Subject: [PATCH 01/14] Add initial test file for mean calculations --- prep/mean.test.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 prep/mean.test.js diff --git a/prep/mean.test.js b/prep/mean.test.js new file mode 100644 index 000000000..e69de29bb From 927769b17de592f6887d046ba0bce8604ffcbd09 Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Fri, 24 Oct 2025 10:13:42 +0100 Subject: [PATCH 02/14] Add mean.js file for mean calculations --- prep/mean.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 prep/mean.js diff --git a/prep/mean.js b/prep/mean.js new file mode 100644 index 000000000..e69de29bb From a393af9cf00e0164a447b9e3a607bb1b6e6b8dc1 Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Sun, 26 Oct 2025 10:05:36 +0000 Subject: [PATCH 03/14] Remove mean.js and mean.test.js files --- prep/mean.js | 0 prep/mean.test.js | 0 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 prep/mean.js delete mode 100644 prep/mean.test.js diff --git a/prep/mean.js b/prep/mean.js deleted file mode 100644 index e69de29bb..000000000 diff --git a/prep/mean.test.js b/prep/mean.test.js deleted file mode 100644 index e69de29bb..000000000 From c26934b62b33b50e6ecaf0b77777d8a895a4a287 Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Thu, 13 Nov 2025 14:38:49 +0000 Subject: [PATCH 04/14] Update title in index.html to reflect the app name --- Sprint-3/reading-list/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/reading-list/index.html b/Sprint-3/reading-list/index.html index dbdb0f471..c67805f51 100644 --- a/Sprint-3/reading-list/index.html +++ b/Sprint-3/reading-list/index.html @@ -4,7 +4,7 @@ - Title here + Reading list app
From 43d53c54181f98d1263987e5a22cf99124b36e35 Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Sat, 15 Nov 2025 17:13:15 +0000 Subject: [PATCH 05/14] Implement renderBooks function to display reading list with styling based on read status --- Sprint-3/reading-list/script.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Sprint-3/reading-list/script.js b/Sprint-3/reading-list/script.js index 6024d73a0..222a17bbd 100644 --- a/Sprint-3/reading-list/script.js +++ b/Sprint-3/reading-list/script.js @@ -21,3 +21,25 @@ const books = [ }, ]; +function renderBooks() { + const unorderedList = document.querySelector("#reading-list"); + for (const book of books) { + const newList = document.createElement("li"); + const newImage = document.createElement("img"); + const title = book.title; + const author = book.author; + newImage.src = book.bookCoverImage; + const paragraph = document.createElement("p"); + paragraph.textContent = `${title} by ${author}`; + newList.appendChild(paragraph); + newList.appendChild(newImage); + if (book.alreadyRead) { + newList.style.backgroundColor = "green"; + } else { + newList.style.backgroundColor = "red"; + } + + unorderedList.appendChild(newList); + } +} +renderBooks(); From 744f0a74f161f95763025a8dc0540086b4ae595c Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Sat, 15 Nov 2025 17:13:30 +0000 Subject: [PATCH 06/14] Add styles for reading list items and images --- Sprint-3/reading-list/style.css | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Sprint-3/reading-list/style.css b/Sprint-3/reading-list/style.css index 74406e64f..1d2bdaef5 100644 --- a/Sprint-3/reading-list/style.css +++ b/Sprint-3/reading-list/style.css @@ -152,6 +152,17 @@ body { background: #87ca8a; } +#reading-list li { + display: flex; + flex-direction: column; + align-items: flex-start; + padding: 10px; + margin-bottom: 10px +} + +#reading-list img { + size: ; +} @media screen and (min-width: 992px) { .navbar-brand > img { max-height: 80px; From 03d9f0854c13d3297789ddfe2954eb1100b87a66 Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Sat, 15 Nov 2025 17:13:42 +0000 Subject: [PATCH 07/14] Fix formatting of reading list in index.html for better readability --- Sprint-3/reading-list/index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sprint-3/reading-list/index.html b/Sprint-3/reading-list/index.html index c67805f51..9fb4759a7 100644 --- a/Sprint-3/reading-list/index.html +++ b/Sprint-3/reading-list/index.html @@ -8,7 +8,8 @@
- +
From 7c2dfb38174b4c7d3d9a5f7dd43237198b567772 Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Sat, 15 Nov 2025 18:00:44 +0000 Subject: [PATCH 08/14] Rename renderBooks function to readingList for consistency and clarity --- Sprint-3/reading-list/package.json | 5 ++++- Sprint-3/reading-list/script.js | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Sprint-3/reading-list/package.json b/Sprint-3/reading-list/package.json index 96f540518..c0f8c2b28 100644 --- a/Sprint-3/reading-list/package.json +++ b/Sprint-3/reading-list/package.json @@ -13,5 +13,8 @@ "bugs": { "url": "https://github.com/CodeYourFuture/CYF-Coursework-Template/issues" }, - "homepage": "https://github.com/CodeYourFuture/CYF-Coursework-Template#readme" + "homepage": "https://github.com/CodeYourFuture/CYF-Coursework-Template#readme", + "devDependencies": { + "jest": "^30.2.0" + } } diff --git a/Sprint-3/reading-list/script.js b/Sprint-3/reading-list/script.js index 222a17bbd..765f7614a 100644 --- a/Sprint-3/reading-list/script.js +++ b/Sprint-3/reading-list/script.js @@ -21,7 +21,7 @@ const books = [ }, ]; -function renderBooks() { +function readingList() { const unorderedList = document.querySelector("#reading-list"); for (const book of books) { const newList = document.createElement("li"); @@ -42,4 +42,4 @@ function renderBooks() { unorderedList.appendChild(newList); } } -renderBooks(); +readingList(); From 3cac639d61e7dc22dffc2e758adcfeac95725f32 Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Sun, 23 Nov 2025 11:58:16 +0000 Subject: [PATCH 09/14] added classes instead of in-line style --- Sprint-3/reading-list/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-3/reading-list/script.js b/Sprint-3/reading-list/script.js index 765f7614a..0dc0bee7f 100644 --- a/Sprint-3/reading-list/script.js +++ b/Sprint-3/reading-list/script.js @@ -34,9 +34,9 @@ function readingList() { newList.appendChild(paragraph); newList.appendChild(newImage); if (book.alreadyRead) { - newList.style.backgroundColor = "green"; + newList.classList.add("read"); } else { - newList.style.backgroundColor = "red"; + newList.classList.add("notRead"); } unorderedList.appendChild(newList); From 74ccd13bf4a2a385846fb23ba82e6d23f3325e90 Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Sun, 23 Nov 2025 11:58:46 +0000 Subject: [PATCH 10/14] added backgroud colors to the elements --- Sprint-3/reading-list/style.css | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Sprint-3/reading-list/style.css b/Sprint-3/reading-list/style.css index 1d2bdaef5..5604bc8b9 100644 --- a/Sprint-3/reading-list/style.css +++ b/Sprint-3/reading-list/style.css @@ -157,7 +157,15 @@ body { flex-direction: column; align-items: flex-start; padding: 10px; - margin-bottom: 10px + margin-bottom: 10px; +} + +.read { + background-color: #87ca8a; +} + +.notRead { + background-color: red; } #reading-list img { From 0ecd3e0e8ed18c3c1f500cc4d6cca3d57887f689 Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Sun, 23 Nov 2025 17:07:38 +0000 Subject: [PATCH 11/14] refactored function to use object destructuring in order to get field values --- Sprint-3/reading-list/script.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Sprint-3/reading-list/script.js b/Sprint-3/reading-list/script.js index 0dc0bee7f..3cab73a6c 100644 --- a/Sprint-3/reading-list/script.js +++ b/Sprint-3/reading-list/script.js @@ -26,9 +26,8 @@ function readingList() { for (const book of books) { const newList = document.createElement("li"); const newImage = document.createElement("img"); - const title = book.title; - const author = book.author; - newImage.src = book.bookCoverImage; + const { title, author, bookCoverImage } = book; + newImage.src = bookCoverImage; const paragraph = document.createElement("p"); paragraph.textContent = `${title} by ${author}`; newList.appendChild(paragraph); From 8dc99061c6c1c43c2007e5a1225ca4f9c82e40a8 Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Sun, 23 Nov 2025 17:08:28 +0000 Subject: [PATCH 12/14] changed test to check for class instead of baxckground color --- Sprint-3/reading-list/script.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sprint-3/reading-list/script.test.js b/Sprint-3/reading-list/script.test.js index 4e3d7367d..fc65e4397 100644 --- a/Sprint-3/reading-list/script.test.js +++ b/Sprint-3/reading-list/script.test.js @@ -68,16 +68,16 @@ describe("Reading list", () => { const firstLi = page.window.document.querySelector( "#reading-list > :first-child" ); - expect(firstLi).toHaveStyle({ backgroundColor: "red" }); + expect(firstLi).toHaveClass("notRead"); const secondLi = page.window.document.querySelector( "#reading-list > :nth-child(2)" ); - expect(secondLi).toHaveStyle({ backgroundColor: "green" }); + expect(secondLi).toHaveClass("read"); const thirdLi = page.window.document.querySelector( "#reading-list > :nth-child(3)" ); - expect(thirdLi).toHaveStyle({ backgroundColor: "green" }); + expect(thirdLi).toHaveClass("read"); }); }); From ff160fc90acade014364821dd4d7dbb03555f19f Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Sun, 23 Nov 2025 17:20:17 +0000 Subject: [PATCH 13/14] changed code to append two nodes in one line --- Sprint-3/reading-list/script.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Sprint-3/reading-list/script.js b/Sprint-3/reading-list/script.js index 3cab73a6c..3a58e92e4 100644 --- a/Sprint-3/reading-list/script.js +++ b/Sprint-3/reading-list/script.js @@ -30,8 +30,7 @@ function readingList() { newImage.src = bookCoverImage; const paragraph = document.createElement("p"); paragraph.textContent = `${title} by ${author}`; - newList.appendChild(paragraph); - newList.appendChild(newImage); + newList.append(paragraph, newImage); if (book.alreadyRead) { newList.classList.add("read"); } else { From 24465d283cc2ee853b7970b17b058c7d253c6e90 Mon Sep 17 00:00:00 2001 From: alexandru-pocovnicu <109530683+alexandru-pocovnicu@users.noreply.github.com> Date: Sun, 23 Nov 2025 17:28:37 +0000 Subject: [PATCH 14/14] added style to the images --- Sprint-3/reading-list/style.css | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sprint-3/reading-list/style.css b/Sprint-3/reading-list/style.css index 5604bc8b9..5579c80df 100644 --- a/Sprint-3/reading-list/style.css +++ b/Sprint-3/reading-list/style.css @@ -169,7 +169,9 @@ body { } #reading-list img { - size: ; + max-width: 100%; + height: auto; + display: block; } @media screen and (min-width: 992px) { .navbar-brand > img {