Skip to content
Open
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
26 changes: 25 additions & 1 deletion src/scripts/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
'use strict';

const pushNotification = (posTop, posRight, title, description, type) => {
// write code here
const notification = document.createElement('div');

notification.classList.add('notification');
notification.classList.add(type);

const titleElement = document.createElement('h2');

titleElement.classList.add('title');
titleElement.textContent = title;
notification.append(titleElement);

const notificationDescription = document.createElement('p');

notificationDescription.textContent = description;
notification.append(notificationDescription);

const topValue = typeof posTop === 'number' ? `${posTop}px` : posTop;
const rightValue = typeof posRight === 'number' ? `${posRight}px` : posRight;

notification.setAttribute('style', `top: ${topValue}; right: ${rightValue};`);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The inline style for the notification is missing position: absolute. Update this line so the style includes position: absolute; top: ...; right: ...; (or set notification.style.position = 'absolute' before appending). The tests expect an exact style string with position: absolute present for all notifications.

document.body.append(notification);

setTimeout(() => {
notification.style.display = 'none';
}, 2000);
};

pushNotification(
Expand Down
Loading