Skip to content
Open
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
9 changes: 9 additions & 0 deletions .test-summary/TEST_SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Test Summary

**Mentors**: For more information on how to review homework assignments, please refer to the [Review Guide](https://github.com/HackYourFuture/mentors/blob/main/assignment-support/review-guide.md).

### 2-Browsers - Week1

| Exercise | Passed | Failed | ESLint |
|--------------|--------|--------|--------|
| ex1-bookList | 6 | - | ✓ |
20 changes: 19 additions & 1 deletion 2-Browsers/Week1/assignment/ex1-bookList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,27 @@ https://hackyourfuture.github.io/example-pages/Browsers/Week1/1-booklist/
//cspell: enable

function createBookList(books) {
// TODO your code goes in here, return the ul element
const ul = document.createElement ('ul');
books.forEach( book => {
const li = document.createElement ('li');
const p = document.createElement ( 'p');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

p.textContent = `${book.title} - ${book.author} `;
const img = document.createElement ('img');
img.src = `https://covers.openlibrary.org/b/isbn/${book.isbn}-M.jpg`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

img.alt = `${book.title} cover`;
li.appendChild (p);
li.appendChild (img);
if (book.alreadyRead) {
li.style.backgroundColor = 'green';
}
else
{ li.style.backgroundColor = 'red'} ;
ul.appendChild (li);
Comment on lines +29 to +36

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

});
return ul;
}


function main() {
const myBooks = [
{
Expand Down
36 changes: 36 additions & 0 deletions 2-Browsers/Week1/assignment/ex1-bookList/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,37 @@
/* Write your style here */
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 20px;
}
h1 {
text-align: center;
color: #333;
}
ul {
list-style-type: none;
padding: 0;
display : grid ;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap : 16px;

}
li {
background: #fff;
margin: 10px 0;
padding: 15px;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
img {
width: 100% ;
height: auto ;
border -radius: 5px ;
display : block ;

}
p {
margin: 0;
padding: 0;
}
Comment on lines +2 to +37

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

18 changes: 18 additions & 0 deletions 2-Browsers/Week1/test-reports/ex1-bookList.report.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
*** Unit Test Error Report ***

PASS .dist/2-Browsers/Week1/unit-tests/ex1-bookList.test.js
br-wk1-ex1-bookList
✅ HTML should be syntactically valid (136 ms)
✅ should have all TODO comments removed
✅ should contain a <ul> that is a child of <div id="bookList"> (2 ms)
✅ should contain a <ul> with 3 <li> elements (1 ms)
✅ should contain an <li> with title and author for each book of the `myBooks` array (1 ms)
✅ should contain an <img> element for each book

Test Suites: 1 passed, 1 total
Tests: 6 passed, 6 total
Snapshots: 0 total
Time: 3.628 s, estimated 13 s
Ran all test suites matching /C:\\Users\\Rimha\\Assignments-Cohort54\\.dist\\2-Browsers\\Week1\\unit-tests\\ex1-bookList.test.js/i.
No linting errors detected.
No spelling errors detected.