Fix hint helper alert
Change-Id: I6e1ac9fa03f62bd25b1139764d727922a5f61c20
diff --git a/dev/js/spec/hintSpec.js b/dev/js/spec/hintSpec.js
index e98b92a..3b07bd9 100644
--- a/dev/js/spec/hintSpec.js
+++ b/dev/js/spec/hintSpec.js
@@ -271,6 +271,14 @@
expect(hint.alert().active).toBeTruthy();
expect(hint.active()).toBeTruthy();
+ // Show again with the same message
+ expect(hint.alert().active).toBeTruthy();
+ hint.update();
+ expect(hint.alert().active).toBeFalsy();
+ hint.alert().show();
+ expect(hint.alert().active).toBeTruthy();
+ expect(hint.alert().element().textContent).toEqual("That does not work!");
+
// Show menu, hide alert!
hint.show(false);
});
diff --git a/dev/js/src/hint/alert.js b/dev/js/src/hint/alert.js
index 7847af2..f142890 100644
--- a/dev/js/src/hint/alert.js
+++ b/dev/js/src/hint/alert.js
@@ -30,9 +30,12 @@
* Show alert.
*/
show : function (msg) {
- this.active = true;
const e = this._el;
- e.textContent = msg;
+ if (msg !== undefined)
+ e.textContent = msg;
+ if (e.textContent == "")
+ return;
+ this.active = true;
e.style.display = 'block';
},
diff --git a/dev/js/src/init.js b/dev/js/src/init.js
index 13904ec..7be0a13 100644
--- a/dev/js/src/init.js
+++ b/dev/js/src/init.js
@@ -307,6 +307,7 @@
if (hint) {
shiftContent();
observer.disconnect();
+ KorAP.Hint.alert().show();
}
}
}
diff --git a/dev/scss/header/hint.scss b/dev/scss/header/hint.scss
index 11f0411..6184dc1 100644
--- a/dev/scss/header/hint.scss
+++ b/dev/scss/header/hint.scss
@@ -30,7 +30,7 @@
margin-top: 8px;
box-shadow: $choose-box-shadow;
width: auto;
- min-width: 10em;
+ min-width: 20em;
max-width: 23em !important;
transition: opacity 0.2s ease 0s;