From 1757aa39ac1ce4e48e7bbe85b72435242d2a8a54 Mon Sep 17 00:00:00 2001 From: Duddino Date: Mon, 11 Nov 2024 10:35:04 +0100 Subject: [PATCH 1/3] Increase alert timeout and set it on createAlert too --- scripts/alerts/alert.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/alerts/alert.js b/scripts/alerts/alert.js index 53d86e4d4..78ed1e4eb 100644 --- a/scripts/alerts/alert.js +++ b/scripts/alerts/alert.js @@ -56,7 +56,7 @@ export class AlertController { * @param {string} message - The message to relay to the user * @param {number?} timeout - The time in `ms` until the alert expires (Defaults to never expiring) */ - createAlert(level, message, timeout = 2000) { + createAlert(level, message, timeout = 10000) { this.addAlert(new Alert({ level, message, timeout })); } @@ -95,7 +95,7 @@ export class AlertController { * @param {string} message - The message to relay to the user * @param {number?} [timeout] - The time in `ms` until the alert expires (Defaults to never expiring) */ -export function createAlert(type, message, timeout = 0) { +export function createAlert(type, message, timeout) { const alertController = AlertController.getInstance(); return alertController.createAlert(type, message, timeout); } From 0e0c1b61e0c46fbd8f88526c75b577e4c4470f57 Mon Sep 17 00:00:00 2001 From: Duddino Date: Mon, 11 Nov 2024 10:39:06 +0100 Subject: [PATCH 2/3] Remove misleading comment --- scripts/alerts/alert.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/alerts/alert.js b/scripts/alerts/alert.js index 78ed1e4eb..c770703a5 100644 --- a/scripts/alerts/alert.js +++ b/scripts/alerts/alert.js @@ -54,7 +54,7 @@ export class AlertController { * - The use of `.innerHTML` allows for input styling at this cost. * @param {'success'|'info'|'warning'} type - The alert level * @param {string} message - The message to relay to the user - * @param {number?} timeout - The time in `ms` until the alert expires (Defaults to never expiring) + * @param {number?} timeout - The time in `ms` until the alert expires */ createAlert(level, message, timeout = 10000) { this.addAlert(new Alert({ level, message, timeout })); @@ -93,7 +93,7 @@ export class AlertController { * - The use of `.innerHTML` allows for input styling at this cost. * @param {'success'|'info'|'warning'} type - The alert level * @param {string} message - The message to relay to the user - * @param {number?} [timeout] - The time in `ms` until the alert expires (Defaults to never expiring) + * @param {number?} [timeout] - The time in `ms` until the alert expires */ export function createAlert(type, message, timeout) { const alertController = AlertController.getInstance(); From 85d816fcd578fb39bb08b2ea3e0b73c9e1aeae44 Mon Sep 17 00:00:00 2001 From: Duddino Date: Mon, 11 Nov 2024 13:51:15 +0100 Subject: [PATCH 3/3] Fix tests --- tests/unit/alert.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/alert.spec.js b/tests/unit/alert.spec.js index 1b7134ee6..8c1612faa 100644 --- a/tests/unit/alert.spec.js +++ b/tests/unit/alert.spec.js @@ -75,7 +75,7 @@ describe('createAlert function', () => { const level = 'info'; createAlert(level, message); - expect(createAlertSpy).toHaveBeenCalledWith(level, message, 0); + expect(createAlertSpy).toHaveBeenCalledWith(level, message, undefined); createAlertSpy.mockRestore(); });