fixed the update form, and update functionality, and formatted

Co-authored-by: Kara Hoagland <KH-Cl@users.noreply.github.com>
Co-authored-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
rheabhutada02 2022-11-21 15:27:45 -08:00
parent 123057f0f1
commit ec9d0246ca
4 changed files with 11 additions and 12 deletions

View File

@ -27,14 +27,13 @@
<!--- meal --> <!--- meal -->
<div class = "meal-name"> <div class = "meal-name">
<h1 id="d-mealName"> Salad (default name) </h1> <h1 id="d-mealName"></h1>
<h1 id="d-restaurant"> Salad Inc. (default name) </h1> <h1 id="d-restaurant"></h1>
</div> </div>
<div class = "meal-pics-and-tags"> <div class = "meal-pics-and-tags">
<!-- image source --> <!-- image source -->
<img src = https://images.pexels.com/photos/1640777/pexels-photo-1640777.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1, <img width=40% height=40% id="d-mealImg"/>
alt = "Meal Photo Corrupted" width=40% height=40% id="d-mealImg">
<div class = "tag-container", id="d-tags"> <div class = "tag-container", id="d-tags">
@ -42,8 +41,8 @@
</div> </div>
<div class = "stars-and-comments"> <div class = "stars-and-comments">
<img src = "./assets/images/icons/5-star.svg" width=10% height=10% id="d-rating"> <img width=10% height=10% id="d-rating"/>
<p id = "d-comments"> Default comment </p> <p id = "d-comments"></p>
</div> </div>
<main> <main>

View File

@ -87,7 +87,7 @@ class ReviewCard extends HTMLElement {
flex-flow: row wrap; flex-flow: row wrap;
} }
.tag { .a-tag {
background-color:#94da97; background-color:#94da97;
border-radius: 7px; border-radius: 7px;
color: #94da97; color: #94da97;
@ -195,7 +195,7 @@ class ReviewCard extends HTMLElement {
if(data["tags"]){ if(data["tags"]){
for (let i = 0; i < data["tags"].length; i++) { for (let i = 0; i < data["tags"].length; i++) {
let newTag = document.createElement("label"); let newTag = document.createElement("label");
newTag.setAttribute("class","tag"); newTag.setAttribute("class","a-tag");
newTag.innerHTML = data["tags"][i]; newTag.innerHTML = data["tags"][i];
tagContainer.append(newTag); tagContainer.append(newTag);
} }

View File

@ -44,7 +44,7 @@ function setupInfo(){
if(currReview["tags"]){ if(currReview["tags"]){
for (let i = 0; i < currReview["tags"].length; i++) { for (let i = 0; i < currReview["tags"].length; i++) {
let newTag = document.createElement("label"); let newTag = document.createElement("label");
newTag.setAttribute("class","tag"); newTag.setAttribute("class","d-tag");
newTag.innerHTML = currReview["tags"][i]; newTag.innerHTML = currReview["tags"][i];
tagContainer.append(newTag); tagContainer.append(newTag);
} }
@ -67,7 +67,7 @@ function setupUpdate(){
let updateBtn = document.getElementById("update-btn"); let updateBtn = document.getElementById("update-btn");
let currID = JSON.parse(sessionStorage.getItem("currID")); let currID = JSON.parse(sessionStorage.getItem("currID"));
let currReview = getReviewFromStorage(currID); let currReview = getReviewFromStorage(currID);
let form = document.getElementById("update-food-entry"); let form = document.getElementById("new-food-entry");
let updateDiv = document.getElementById("update-form"); let updateDiv = document.getElementById("update-form");
updateBtn.addEventListener("click", function(){ updateBtn.addEventListener("click", function(){
//update function //update function
@ -171,7 +171,7 @@ function setupUpdate(){
updateReviewToStorage(currID, newData); updateReviewToStorage(currID, newData);
form.style.display = "none"; updateDiv.classList.add("hidden");
}); });

View File

@ -59,7 +59,7 @@ export async function checkCorrectness(root, prefix, expected){
assert.strictEqual(await restaurant_text.jsonValue(), expected.restaurant); assert.strictEqual(await restaurant_text.jsonValue(), expected.restaurant);
// Check tags // Check tags
let tags = await root.$$(".tag"); let tags = await root.$$(`.${prefix}-tag`);
assert.strictEqual(await tags.length, expected.tags.length); assert.strictEqual(await tags.length, expected.tags.length);
for(let i = 0; i < expected.tags.length; i++){ for(let i = 0; i < expected.tags.length; i++){
let tag_text = await tags[i].getProperty("innerText"); let tag_text = await tags[i].getProperty("innerText");