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

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);
$(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);
}
}
})();