1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

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
This commit is contained in:
Nick O'Leary 2018-12-06 10:51:56 +00:00
parent d9aadf9d98
commit 09cd710f66
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -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);
if (!RED.notifications.hide) {
$(n).slideDown(300);
}
n.close = (function() {
var nn = n;
return function() {
@ -123,9 +129,13 @@ RED.notifications = (function() {
notificationButtonWrapper.hide();
}
}
if (!RED.notifications.hide) {
$(nn).slideUp(300, function() {
nn.parentNode.removeChild(nn);
});
} else {
nn.parentNode.removeChild(nn);
}
if (options.modal) {
$("#full-shade").hide();
}
@ -138,8 +148,10 @@ RED.notifications = (function() {
return
}
nn.hidden = true;
if (!RED.notifications.hide) {
$(nn).slideUp(300);
}
}
})();
n.showNotification = (function() {
var nn = n;
@ -148,8 +160,10 @@ RED.notifications = (function() {
return
}
nn.hidden = false;
if (!RED.notifications.hide) {
$(nn).slideDown(300);
}
}
})();
n.update = (function() {