Fix deep-recursion problem with whitespace trimming in menu prefixes

Change-Id: I30428302ca9847d9728035d1a75909ebd05fb93d
diff --git a/dev/js/spec/menuSpec.js b/dev/js/spec/menuSpec.js
index db3e968..a60d7ab 100644
--- a/dev/js/spec/menuSpec.js
+++ b/dev/js/spec/menuSpec.js
@@ -819,6 +819,24 @@
         expect(menu.shownItem(2)).toBe(undefined);
       });
 
+      it('should be filterable (trimming = " p")', function () {
+        var menu = KorAP.HintMenu.create("/p=", listMultiPrefix);
+        // menu._firstActive = true;
+
+        menu.limit(2);
+        expect(menu.show()).toBe(true);
+        menu._prefix.add(" ");
+        expect(menu.show()).toBe(true);
+        menu._prefix.add("p")
+        expect(menu.show()).toBe(true);
+        expect(menu.shownItem(0).name()).toEqual("PP");
+        expect(menu.element().childNodes[3].innerHTML).toEqual(
+          "<strong><mark>P</mark><mark>P</mark></strong>"+
+            "<span><mark>P</mark>ersonal <mark>P</mark>ronoun</span>"
+        );
+      });
+
+      
       it('should choose prefix with failing prefix (1)', function () {
         var menu = KorAP.HintMenu.create("cnx/", list);
         menu.limit(2);