Integrated hint alerts in the main frame
diff --git a/dev/js/spec/hintSpec.js b/dev/js/spec/hintSpec.js
index 554b61d..c944410 100644
--- a/dev/js/spec/hintSpec.js
+++ b/dev/js/spec/hintSpec.js
@@ -53,9 +53,10 @@
afterAll(function () {
try {
- document.getElementsByTagName("body")[0].removeChild(
- document.getElementById("searchMirror")
- );
+ var mirrors = document.querySelectorAll(".hint.mirror");
+ for (var i in mirrors) {
+ mirrors[i].parentNode.removeChild(mirrors[i])
+ };
}
catch (e) {};
});
@@ -168,6 +169,34 @@
expect(hint).toBeTruthy();
});
+
+ it('should alert at char pos', function () {
+ var hint = hintClass.create({
+ inputField : input
+ });
+
+ expect(hint.active()).toBeFalsy();
+
+ expect(hint.alert(4, 'That does not work!')).toBeTruthy();
+
+ expect(hint.active()).toBeTruthy();
+
+ var container = hint.inputField().container();
+ expect(container.firstChild.classList.contains('hint')).toBe(true);
+ expect(container.firstChild.classList.contains('alert')).toBe(true);
+ expect(container.firstChild.textContent).toEqual('That does not work!');
+ expect(hint.inputField().mirrorValue()).toEqual('abcd');
+
+ expect(hint.alert(4, 'That does not work!')).toBeFalsy();
+
+ // Update - meaning: hide alert
+ hint.update();
+
+ expect(hint.alert().active).toBeFalsy();
+
+ expect(hint.active()).toBeFalsy();
+
+ });
});
describe('KorAP.HintMenuItem', function () {