Commit c8445fce authored by dmacfarlane's avatar dmacfarlane
Browse files

Fixed issue with menu not showing after back space

parent 52430d9a
Loading
Loading
Loading
Loading
+18 −4
Original line number Diff line number Diff line
@@ -54,12 +54,12 @@ describe('angular2-mentions App', function() {

      // popup menu
      el.sendKeys('Hello @');
      //browser.wait(EC.textToBePresentInElementValue(el, 'Hello @'), 1000);
      expect(menu.isDisplayed()).toBe(true);
      expect(getValue(el, tagName)).toEqual('Hello @');
            
      // select mention using arrow keys and pressing enter
      // el.sendKeys(protractor.Key.ARROW_DOWN, protractor.Key.ENTER);

      // select mention by clicking mouse on second item in menu
      element(by.css('.dropdown-menu li:nth-child(2) a')).click();
      expect(menu.isDisplayed()).toBe(false);
@@ -70,8 +70,22 @@ describe('angular2-mentions App', function() {
      expect(menu.isDisplayed()).toBe(false);
      expect(getValue(el, tagName)).toEqual('Hello @Aaron and @Gavin');
      
      // start another mention (with no values)
      el.sendKeys(' and @u');
      expect(menu.isDisplayed()).toBe(false);
      expect(getValue(el, tagName)).toEqual('Hello @Aaron and @Gavin and @u');
      
      // remove the mention
      el.sendKeys(protractor.Key.BACK_SPACE, protractor.Key.BACK_SPACE);
      expect(getValue(el, tagName)).toEqual('Hello @Aaron and @Gavin and ');

      // start another mention
      el.sendKeys(' and @e');
      el.sendKeys('@');
      expect(menu.isDisplayed()).toBe(true);
      expect(getValue(el, tagName)).toEqual('Hello @Aaron and @Gavin and @');

      // continue the mention
      el.sendKeys('e');
      expect(menu.isDisplayed()).toBe(true);
      expect(getValue(el, tagName)).toEqual('Hello @Aaron and @Gavin and @e');
      
+1 −0
Original line number Diff line number Diff line
@@ -154,6 +154,7 @@ export class MentionDirective implements OnInit, OnChanges {
      this.startPos = pos;
      this.startNode = (this.iframe ? this.iframe.contentWindow.getSelection() : window.getSelection()).anchorNode;
      this.stopSearch = false;
      this.searchString = null;
      this.showSearchList(nativeElement);
      this.updateSearchList();
    }