From 23bf3a2c841c4d10ccee33754b5d9cb5c517ad18 Mon Sep 17 00:00:00 2001 From: Kara Hoagland Date: Wed, 30 Nov 2022 16:35:45 -0800 Subject: [PATCH 1/3] fix create page tag duplicate --- source/assets/scripts/CreatePage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/assets/scripts/CreatePage.js b/source/assets/scripts/CreatePage.js index b60a016..a4e128d 100644 --- a/source/assets/scripts/CreatePage.js +++ b/source/assets/scripts/CreatePage.js @@ -97,10 +97,10 @@ function initFormHandler() { let tagLabel = document.createElement("label"); tagLabel.innerHTML = tagField.value; tagLabel.setAttribute("class","tag"); - tagSet.add(tagField.value.toLowerCase()); + tagSet.add(tagSetVal); tagLabel.addEventListener("click",()=> { tagContainer.removeChild(tagLabel); - tagSet.delete(tagField.value.toLowerCase()); + tagSet.delete(tagSetVal); }); tagContainer.append(tagLabel); From 64d57ffd90a16983df2fbd206a13f15c87af58f3 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Wed, 30 Nov 2022 16:36:21 -0800 Subject: [PATCH 2/3] fix review details html id consistency, fix appTestHelpers with proper element selection Signed-off-by: Arthur Lu --- source/assets/scripts/ReviewCard.js | 6 +++--- source/assets/scripts/appTestHelpers.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/assets/scripts/ReviewCard.js b/source/assets/scripts/ReviewCard.js index eda7c15..331c8b1 100644 --- a/source/assets/scripts/ReviewCard.js +++ b/source/assets/scripts/ReviewCard.js @@ -158,7 +158,7 @@ class ReviewCard extends HTMLElement { //image setup let mealImg = document.createElement("img"); - mealImg.setAttribute("id", "a-mealImg"); + mealImg.setAttribute("id", "a-meal-img"); mealImg.setAttribute("alt","Meal Photo Corrupted"); mealImg.setAttribute("src",data["mealImg"]); mealImg.addEventListener("error", function(e) { @@ -170,7 +170,7 @@ class ReviewCard extends HTMLElement { let meallabelDiv = document.createElement("div"); meallabelDiv.setAttribute("class", "meal-name-div"); let mealLabel = document.createElement("label"); - mealLabel.setAttribute("id", "a-mealName"); + mealLabel.setAttribute("id", "a-meal-name"); mealLabel.setAttribute("class","meal-name"); mealLabel.innerHTML = data["mealName"]; meallabelDiv.append(mealLabel); @@ -252,7 +252,7 @@ class ReviewCard extends HTMLElement { dataContainer["reviewID"] = this.reviewID; //get image - let mealImg = this.shadowEl.getElementById("a-mealImg"); + let mealImg = this.shadowEl.getElementById("a-meal-img"); dataContainer["mealImg"] = mealImg.getAttribute("src"); //get meal name diff --git a/source/assets/scripts/appTestHelpers.js b/source/assets/scripts/appTestHelpers.js index 37e7cb4..aa4b1db 100644 --- a/source/assets/scripts/appTestHelpers.js +++ b/source/assets/scripts/appTestHelpers.js @@ -40,13 +40,13 @@ export async function setReviewForm(page, review) { */ export async function checkCorrectness(root, prefix, expected){ // Get the review image and check src - let img = await root.$(`#${prefix}-mealImg`); + let img = await root.$(`#${prefix}-meal-img`); let imgSrc = await img.getProperty("src"); // Check src assert.strictEqual(await imgSrc.jsonValue(), expected.imgSrc); // Get the title, comment, and restaurant - let title = await root.$(`#${prefix}-mealName`); + let title = await root.$(`#${prefix}-meal-name`); let title_text = await title.getProperty("innerText"); let comment = await root.$(`#${prefix}-comments`); let comment_text = await comment.getProperty("innerText"); From eb3133c676c45f6496f4a14a58c8cf84ce4bf38f Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Wed, 30 Nov 2022 17:02:42 -0800 Subject: [PATCH 3/3] fix ReviewCard.js element id issue Signed-off-by: Arthur Lu --- source/assets/scripts/ReviewCard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/assets/scripts/ReviewCard.js b/source/assets/scripts/ReviewCard.js index 331c8b1..00093d8 100644 --- a/source/assets/scripts/ReviewCard.js +++ b/source/assets/scripts/ReviewCard.js @@ -256,7 +256,7 @@ class ReviewCard extends HTMLElement { dataContainer["mealImg"] = mealImg.getAttribute("src"); //get meal name - let mealLabel = this.shadowEl.getElementById("a-mealName"); + let mealLabel = this.shadowEl.getElementById("a-meal-name"); dataContainer["mealName"] = mealLabel.innerHTML; //get comment section