 describe 'fsMultiselect', ->
   $ptor = protractor
+
+  #
+  pressEnter = (element) ->
+    element.sendKeys("\n")
 
   beforeEach ->
     browser.get('multiselect.html')

    input = $('.second-select input')
    input.click()
    input.sendKeys("gzigzigzeo")
    input.sendKeys($ptor.Key.ENTER)

    expect($(".second-select .fs-multiselect-selected-items a").getText()).toBe("gzigzigzeo")
    expect($("#secondValue").getText()).toMatch(/gzigzigzeo/)

  it 'should allow to select multiple values', ->
    input = $('.first-select input')
    input.click()
    pressEnter(input)
    pressEnter(input)

    # check that dropdown wasn't closed
    expect(element.all(By.css(".first-select .dropdown-menu li")).count()).toBe(1)
