-
Notifications
You must be signed in to change notification settings - Fork 7
Alaa nasher w1 browsers #22
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| ## 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 | - | ✓ | | ||
| | ex2-aboutMe | 4 | - | ✓ | | ||
| | ex3-hijackLogo | 3 | - | ✓ | | ||
| | ex4-whatsTheTime | 6 | - | ✓ | | ||
| | ex5-catWalk | 5 | - | ✓ | |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,17 @@ | ||
| /* Write your style here */ | ||
|
|
||
| ul { | ||
| list-style: none; | ||
| padding: 0; | ||
| margin: 0; | ||
| } | ||
|
|
||
| ul li { | ||
| width: 500px; | ||
| padding: 20px; | ||
| text-align: center; | ||
| border-radius: 6px; | ||
| margin-bottom: 20px; | ||
| display: inline-block; | ||
| margin-right: 12px; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,4 +8,10 @@ Full description at: https://github.com/HackYourFuture/Assignments/tree/main/2-B | |
| 3. Look in the css file! | ||
| ------------------------------------------------------------------------------*/ | ||
|
|
||
| // TODO add your JavaScript code here. | ||
| const ul = document.querySelector('ul').children; | ||
| ul[0].textContent = 'Alooy'; | ||
|
||
| ul[1].textContent = 'Burgers'; | ||
| ul[2].textContent = 'Dongen'; | ||
|
|
||
| const arr = Array.from(ul); | ||
| arr.forEach((ele) => (ele.className = 'list-item')); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,4 @@ | ||
| /* 3. Add a css rule for .list-item to make the color red. */ | ||
| .list-item { | ||
| color: red; | ||
| } |
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm afraid to say I can't really check this exercise, because Google as it shows up on my computer doesn't show an |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,18 @@ Full description at: https://github.com/HackYourFuture/Assignments/tree/main/2-B | |
| 2. Have the function execute when it's loading in the browser. | ||
| ------------------------------------------------------------------------------*/ | ||
| function addCurrentTime() { | ||
| // TODO complete this function | ||
| const div = document.createElement('div'); | ||
| const span = document.createElement('span'); | ||
|
|
||
| return setInterval(function () { | ||
| const time = new Date(); | ||
| const hours = String(time.getHours()).padStart(2, '0'); | ||
| const minutes = String(time.getMinutes()).padStart(2, '0'); | ||
| const seconds = String(time.getSeconds()).padStart(2, '0'); | ||
| span.textContent = `${hours}:${minutes}:${seconds}`; | ||
| div.appendChild(span); | ||
|
||
| document.body.appendChild(div); | ||
| }, 1000); | ||
| } | ||
|
|
||
| // TODO execute `addCurrentTime` when the browser has completed loading the page | ||
| window.addEventListener('load', addCurrentTime); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your solutions does seem to do something, but the cate moves at an incredibly slow pace, and it just seems like you might not have been crafting this solution yourself in a constructive way, and rather relying on prediction and/or AI. I'd like to point out that for a development workflow, you need to at least follow these steps:
Please try to redo this exercise, following this process. Note that this is the hardest exercise of the bunch, so it's totally understandable if you're having trouble with it :) I If you can't get any further with this exercise, it might be wise to schedule a little call (possibly shared with others) to discuss how to approach this kind of exercise. Let me know :)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried to do it, but I’m not sure. I think I have a problem with getting the middle of the screen and resuming the function. I would appreciate it if we could schedule a call to go through it thoroughly. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| function replaceLogo() { | ||
| const logo = document.querySelector( | ||
| 'img[alt="Google"], img[src*="googlelogo"]' | ||
| ); | ||
| if (!logo) return; | ||
| logo.src = chrome.runtime.getURL('images.png'); // uses packaged image | ||
| logo.removeAttribute('srcset'); | ||
| logo.alt = 'HackYourFuture'; | ||
| } | ||
|
|
||
| // run once | ||
| replaceLogo(); | ||
|
|
||
| // reapply if the page updates the logo later | ||
| const obs = new MutationObserver(() => replaceLogo()); | ||
| obs.observe(document.documentElement, { childList: true, subtree: true }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>Document</title> | ||
| </head> | ||
| <body> | ||
| <script src="extra.js"></script> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| *** Unit Test Error Report *** | ||
|
|
||
| PASS .dist/2-Browsers/Week1/unit-tests/ex1-bookList.test.js | ||
| br-wk1-ex1-bookList | ||
| ✅ HTML should be syntactically valid (165 ms) | ||
| ✅ should have all TODO comments removed (1 ms) | ||
| ✅ should contain a <ul> that is a child of <div id="bookList"> (1 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 (2 ms) | ||
| ✅ should contain an <img> element for each book (1 ms) | ||
|
|
||
| Test Suites: 1 passed, 1 total | ||
| Tests: 6 passed, 6 total | ||
| Snapshots: 0 total | ||
| Time: 3.105 s, estimated 4 s | ||
| Ran all test suites matching /\/Users\/Alaa\/Desktop\/JavaScript-Cohort54\/.dist\/2-Browsers\/Week1\/unit-tests\/ex1-bookList.test.js/i. | ||
| No linting errors detected. | ||
|
|
||
|
|
||
| *** Spell Checker Report *** | ||
|
|
||
| 2-Browsers/Week1/assignment/ex1-bookList/index.js:33:35 - Unknown word (lightgreen) | ||
| 2-Browsers/Week1/assignment/ex1-bookList/index.js:35:35 - Unknown word (lightcoral) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| *** Unit Test Error Report *** | ||
|
|
||
| PASS .dist/2-Browsers/Week1/unit-tests/ex2-aboutMe.test.js | ||
| br-wk1-ex2-aboutMe | ||
| ✅ should be syntactically valid (316 ms) | ||
| ✅ should have all TODO comments removed (1 ms) | ||
| ✅ each <li> should have the CSS class `list-item` (1 ms) | ||
| ✅ each <li> should rendered red (= rgb(255, 0, 0)) (24 ms) | ||
|
|
||
| Test Suites: 1 passed, 1 total | ||
| Tests: 4 passed, 4 total | ||
| Snapshots: 0 total | ||
| Time: 3.301 s | ||
| Ran all test suites matching /\/Users\/Alaa\/Desktop\/JavaScript-Cohort54\/.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:12:22 - Unknown word (Alooy) | ||
| 2-Browsers/Week1/assignment/ex2-aboutMe/index.js:14:22 - Unknown word (Dongen) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| *** Unit Test Error Report *** | ||
|
|
||
| PASS .dist/2-Browsers/Week1/unit-tests/ex3-hijackLogo.test.js | ||
| br-wk1-ex3-hijackLogo | ||
| ✅ should have all TODO comments removed (1 ms) | ||
| ✅ should set the `.src` property | ||
| ✅ should set the `.srcset` property | ||
|
|
||
| Test Suites: 1 passed, 1 total | ||
| Tests: 3 passed, 3 total | ||
| Snapshots: 0 total | ||
| Time: 0.438 s, estimated 1 s | ||
| Ran all test suites matching /\/Users\/Alaa\/Desktop\/JavaScript-Cohort54\/.dist\/2-Browsers\/Week1\/unit-tests\/ex3-hijackLogo.test.js/i. | ||
| No linting errors detected. | ||
|
|
||
|
|
||
| *** Spell Checker Report *** | ||
|
|
||
| 2-Browsers/Week1/assignment/ex3-hijackLogo.js:11:35 - Unknown word (googlelogo) |
| 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/ex4-whatsTheTime.test.js | ||
| br-wk1-ex4-whatsTheTime | ||
| ✅ HTML should be syntactically valid (171 ms) | ||
| ✅ should have all TODO comments removed (1 ms) | ||
| ✅ should use `setInterval()` | ||
| ✅ should not call `setInterval()` more than once (2003 ms) | ||
| ✅ should use `window.onload` or `window.addEventListener()` for the `load` or `DOMContentLoaded` event (1 ms) | ||
| ✅ `window.onload` or `window.addEventListener` should not call its event handler function (1 ms) | ||
|
|
||
| Test Suites: 1 passed, 1 total | ||
| Tests: 6 passed, 6 total | ||
| Snapshots: 0 total | ||
| Time: 4.988 s, estimated 5 s | ||
| Ran all test suites matching /\/Users\/Alaa\/Desktop\/JavaScript-Cohort54\/.dist\/2-Browsers\/Week1\/unit-tests\/ex4-whatsTheTime.test.js/i. | ||
| No linting errors detected. | ||
| No spelling errors detected. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| *** Unit Test Error Report *** | ||
|
|
||
| PASS .dist/2-Browsers/Week1/unit-tests/ex5-catWalk.test.js | ||
| br-wk1-ex5-catWalk | ||
| ✅ HTML should be syntactically valid (165 ms) | ||
| ✅ should have all TODO comments removed | ||
| ✅ should use `setInterval()` and/or `setTimeout()` | ||
| ✅ should use `window.onload` or `window.addEventListener()` for the `load` or `DOMContentLoaded` event | ||
| ✅ `window.onload` or `window.addEventListener` should not call its event handler function (1 ms) | ||
|
|
||
| Test Suites: 1 passed, 1 total | ||
| Tests: 5 passed, 5 total | ||
| Snapshots: 0 total | ||
| Time: 2.958 s, estimated 3 s | ||
| Ran all test suites matching /\/Users\/Alaa\/Desktop\/JavaScript-Cohort54\/.dist\/2-Browsers\/Week1\/unit-tests\/ex5-catWalk.test.js/i. | ||
| No linting errors detected. | ||
| No spelling errors detected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Textbook solution, well done :)