Fix the queued alerts not being displayed

This commit is contained in:
Raoul Snyman 2019-09-12 15:39:57 -07:00
parent 3b87327682
commit 671abe1def
2 changed files with 5 additions and 0 deletions

View File

@ -484,6 +484,7 @@ var Display = {
alertBackground.classList.replace("hide", "show");
alertText.innerHTML = text;
Display.setAlertLocation(settings.location);
Display._transitionState = TransitionState.EntranceTransition;
/* Check if the alert is a queued alert */
if (Display._alertState !== AlertState.Displaying) {
Display._alertState = AlertState.Displaying;
@ -512,6 +513,7 @@ var Display = {
hideAlert: function () {
var alertBackground = $('#alert-background')[0];
var alertText = $('#alert-text')[0];
Display._transitionState = TransitionState.ExitTransition;
alertText.classList.replace("show", "hide");
alertBackground.classList.replace("show", "hide");
alertText.style.animation = "";
@ -575,7 +577,9 @@ var Display = {
* Display the next alert in the queue
*/
showNextAlert: function () {
console.log("showNextAlert");
if (Display._alerts.length > 0) {
console.log("Showing next alert");
var alertObject = Display._alerts.shift();
Display._alertState = AlertState.DisplayingFromQueue;
Display.showAlert(alertObject.text, alertObject.settings);

View File

@ -281,6 +281,7 @@ describe("Display.hideAlert", function () {
Display.hideAlert();
expect(Display._transitionState).toEqual(TransitionState.ExitTransition);
expect(alertBackground.classList.contains("hide")).toEqual(true);
expect(alertBackground.classList.contains("show")).toEqual(false);
expect(alertText.classList.contains("hide")).toEqual(true);