Skip to content

ETEM_OZDEMIR-w2-Browsers #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
28 changes: 27 additions & 1 deletion 2-Browsers/Week1/assignment/ex1-bookList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,33 @@ 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 ulElement = document.createElement('ul');
ulElement.style.listStyleType = 'none';

books.forEach((book) => {
const liElement = document.createElement('li');
liElement.classList.add('list-item');
liElement.style.marginBottom = '20px';

const pElement = document.createElement('p');
pElement.textContent = `${book.title} - ${book.author}`;
liElement.appendChild(pElement);

const imgElement = document.createElement('img');
imgElement.src = `https://via.placeholder.com/100x150?text=${book.title}`;
imgElement.style.marginRight = '20px';
liElement.appendChild(imgElement);

if (book.alreadyRead) {
liElement.style.backgroundColor = 'green';
} else {
liElement.style.backgroundColor = 'red';
}

ulElement.appendChild(liElement);
});

return ulElement;
}

function main() {
Expand Down
5 changes: 3 additions & 2 deletions 2-Browsers/Week1/assignment/ex2-aboutMe/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ Full description at: https://github.com/HackYourFuture/Assignments/tree/main/2-B
`list-item`.
3. Look in the css file!
------------------------------------------------------------------------------*/

// TODO add your JavaScript code here.
document.getElementById('nickname').textContent = 'Etem';
document.getElementById('fav-food').textContent = 'Pizza';
document.getElementById('hometown').textContent = 'Leiden';
32 changes: 32 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,32 @@
*** Unit Test Error Report ***

Command failed: npx jest /Users/benetem/HYF/Assignments-cohort52/.dist/2-Browsers/Week1/unit-tests/ex1-bookList.test.js --colors --noStackTrace --json
FAIL .dist/2-Browsers/Week1/unit-tests/ex1-bookList.test.js
br-wk1-ex1-bookList
❌ HTML should be syntactically valid (90 ms)
✅ should have all TODO comments removed
✅ should contain a <ul> that is a child of <div id="bookList"> (1 ms)
✅ should contain a <ul> with 3 <li> elements
✅ 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

● br-wk1-ex1-bookList › HTML should be syntactically valid

expect(received).toBe(expected) // Object.is equality

Expected: ""
Received: "
inline
11:183 error <img> is missing required \"alt\" attribute wcag/h37
11:419 error <img> is missing required \"alt\" attribute wcag/h37
11:646 error <img> is missing required \"alt\" attribute wcag/h37·
✖ 3 problems (3 errors, 0 warnings)
"

Test Suites: 1 failed, 1 total
Tests: 1 failed, 5 passed, 6 total
Snapshots: 0 total
Time: 2.179 s, estimated 7 s
Ran all test suites matching /\/Users\/benetem\/HYF\/Assignments-cohort52\/.dist\/2-Browsers\/Week1\/unit-tests\/ex1-bookList.test.js/i.
No linting errors detected.
No spelling errors detected.
33 changes: 33 additions & 0 deletions 2-Browsers/Week1/test-reports/ex2-aboutMe.report.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
*** Unit Test Error Report ***

Command failed: npx jest /Users/benetem/HYF/Assignments-cohort52/.dist/2-Browsers/Week1/unit-tests/ex2-aboutMe.test.js --colors --noStackTrace --json
FAIL .dist/2-Browsers/Week1/unit-tests/ex2-aboutMe.test.js
br-wk1-ex2-aboutMe
✅ should be syntactically valid (94 ms)
✅ should have all TODO comments removed
❌ each <li> should have the CSS class `list-item` (1 ms)
❌ each <li> should rendered red (= rgb(255, 0, 0)) (10 ms)

● br-wk1-ex2-aboutMe › each <li> should have the CSS class `list-item`

expect(received).toBeTruthy()

Received: false

● br-wk1-ex2-aboutMe › each <li> should rendered red (= rgb(255, 0, 0))

expect(received).toBeTruthy()

Received: false

Test Suites: 1 failed, 1 total
Tests: 2 failed, 2 passed, 4 total
Snapshots: 0 total
Time: 1.869 s, estimated 2 s
Ran all test suites matching /\/Users\/benetem\/HYF\/Assignments-cohort52\/.dist\/2-Browsers\/Week1\/unit-tests\/ex2-aboutMe.test.js/i.
No linting errors detected.


*** Spell Checker Report ***

2-Browsers/Week1/assignment/ex2-aboutMe/index.js:10:52 - Unknown word (Etem)
Loading