From 09cd710f663a457e7911d829e6f94c4ce9e69e7b Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 6 Dec 2018 10:51:56 +0000 Subject: [PATCH] Add RED.notifications.hide flag For use by the UI tests to suppress notifications from being displayed in the editor. It is not for use by end-users and not exposed in any way other than via javascript injection by the UI tests --- .../editor-client/src/js/ui/notifications.js | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/notifications.js b/packages/node_modules/@node-red/editor-client/src/js/ui/notifications.js index e232af282..af7fd31b4 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/notifications.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/notifications.js @@ -16,6 +16,10 @@ RED.notifications = (function() { /* + If RED.notifications.hide is set to true, all notifications will be hidden. + This is to help with UI testing in certain cases and not intended for the + end-user. + // Example usage for a modal dialog with buttons var myNotification = RED.notify("This is the message to display",{ modal: true, @@ -108,7 +112,9 @@ RED.notifications = (function() { $("#notifications").append(n); - $(n).slideDown(300); + if (!RED.notifications.hide) { + $(n).slideDown(300); + } n.close = (function() { var nn = n; return function() { @@ -123,9 +129,13 @@ RED.notifications = (function() { notificationButtonWrapper.hide(); } } - $(nn).slideUp(300, function() { + if (!RED.notifications.hide) { + $(nn).slideUp(300, function() { + nn.parentNode.removeChild(nn); + }); + } else { nn.parentNode.removeChild(nn); - }); + } if (options.modal) { $("#full-shade").hide(); } @@ -138,7 +148,9 @@ RED.notifications = (function() { return } nn.hidden = true; - $(nn).slideUp(300); + if (!RED.notifications.hide) { + $(nn).slideUp(300); + } } })(); n.showNotification = (function() { @@ -148,7 +160,9 @@ RED.notifications = (function() { return } nn.hidden = false; - $(nn).slideDown(300); + if (!RED.notifications.hide) { + $(nn).slideDown(300); + } } })();