add task solution#1806
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am requesting changes because some core requirements of the notification task are not yet met, and these gaps are causing the end‑to‑end tests to fail. In src/scripts/main.js, inside pushNotification, you correctly create the notification elements and call the function three times, but you never append the created node to the DOM (e.g., document.body.append(node)), so Cypress never finds .notification.success, .notification.error, or .notification.warning elements. The title h2 you create is missing the required title class, so you should add titleNode.classList.add('title') to satisfy the spec and related checklist items [CHECKLIST ITEM #7, #13]. The positioning logic assigns node.style.top = posTop and node.style.right = posRight without units, which breaks when numeric values are passed; concatenate 'px' or accept a full CSS unit string (e.g., node.style.top = posTop + 'px'). You also need to hide the notification visually after 2000 ms instead of removing it from the DOM by wrapping a style change (such as node.style.display = 'none' or node.style.visibility = 'hidden') in a setTimeout(..., 2000) to satisfy the timing and DOM‑persistence requirements [CHECKLIST ITEM #4, #12, #15]. These issues are all critical blockers because they prevent notifications from ever becoming visible to the user and from behaving as the tests expect. On the positive side, your function signature, class assignment for notification and type, and use of h2/p are aligned with the task, so once you wire the node into the DOM, fix the units, add the title class, and implement the timed hide, your solution should be in good shape.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| const pushNotification = (posTop, posRight, title, description, type) => { | ||
| // write code here | ||
| const node = document.createElement('div'); | ||
| const titleNode = document.createElement('h2'); |
|
|
||
| node.classList.add(`notification`, type); | ||
|
|
||
| node.style.top = posTop; |
There was a problem hiding this comment.
Assigning node.style.top = posTop will not include units when posTop is a number. Use a string with units (for example node.style.top = posTop + 'px') so positioning works reliably.
| node.classList.add(`notification`, type); | ||
|
|
||
| node.style.top = posTop; | ||
| node.style.right = posRight; |
There was a problem hiding this comment.
Same for right: set node.style.right = posRight + 'px' (or accept a proper CSS unit string) so the value is valid CSS.
|
|
||
| node.append(titleNode); | ||
| node.append(descripNode); | ||
|
|
There was a problem hiding this comment.
The notification node is never appended to the document, so it will not be visible. Append it (for example document.body.append(node)), ideally after setting its content and classes to satisfy checklist item #3.
| node.append(descripNode); | ||
|
|
||
| titleNode.innerText = title; | ||
| descripNode.innerText = description; |
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution is approved because it correctly implements pushNotification in src/scripts/main.js to meet all stated requirements. The function creates a notification element with both the base notification class and the dynamic type class, adds an h2 with the title class plus a p for the description, appends it to the document body, and positions it using pixel units for the coordinates. You also correctly trigger the three required notifications (success, error, warning) and use setTimeout to hide the notification visually after 2000 ms via style.visibility = 'hidden' instead of removing it from the DOM. There are no critical or blocking issues that would prevent the feature from working as specified. As minor, optional improvements, you might consider using style.display = 'none' if you want the element removed from the layout flow, and textContent instead of innerText for slightly more consistent behavior across environments. Overall, this is a solid, requirement-compliant implementation—well done.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
DEMO LINK