Commit 1ac5f764 authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett Committed by Luke Bennett

Fixed test turbolink condition

parent 40d869ee
...@@ -307,7 +307,7 @@ class GitLabDropdown ...@@ -307,7 +307,7 @@ class GitLabDropdown
shouldPropagate: (e) => shouldPropagate: (e) =>
$target = $(e.target) if @options.multiSelect $target = $(e.target) if @options.multiSelect
unless $target.hasClass('dropdown-menu-close') and $target.hasClass('dropdown-menu-close-icon') and $target.data('is-link') if $target and not $target.hasClass('dropdown-menu-close') and not $target.hasClass('dropdown-menu-close-icon') and not $target.data('is-link')
e.stopPropagation() e.stopPropagation()
false false
else else
...@@ -380,10 +380,10 @@ class GitLabDropdown ...@@ -380,10 +380,10 @@ class GitLabDropdown
html = '' html = ''
# Divider # Divider
return '<li class='divider'></li>' if data is 'divider' return '<li class="divider"></li>' if data is 'divider'
# Separator is a full-width divider # Separator is a full-width divider
return '<li class='separator'></li>' if data is 'separator' return '<li class="separator"></li>' if data is 'separator'
# Header # Header
return _.template('<li class="dropdown-header"><%- header %></li>')({ header: data.header }) if data.header? return _.template('<li class="dropdown-header"><%- header %></li>')({ header: data.header }) if data.header?
......
...@@ -81,11 +81,12 @@ describe 'Dropdown', -> ...@@ -81,11 +81,12 @@ describe 'Dropdown', ->
navigateWithKeys 'down', randomIndex, => navigateWithKeys 'down', randomIndex, =>
spyOn(Turbolinks, 'visit').and.stub() spyOn(Turbolinks, 'visit').and.stub()
navigateWithKeys 'enter', null, => navigateWithKeys 'enter', null, =>
expect(@dropdownContainerElement).not.toHaveClass 'open'
link = $("#{ITEM_SELECTOR}:eq(#{randomIndex}) a", @dropdownMenuElement) link = $("#{ITEM_SELECTOR}:eq(#{randomIndex}) a", @dropdownMenuElement)
expect(link).toHaveClass 'is-active' expect(link).toHaveClass 'is-active'
if link.attr 'href' linkedLocation = link.attr 'href'
expect(Turbolinks.visit).toHaveBeenCalledWith link.attr 'href' if linkedLocation and linkedLocation isnt '#'
expect(@dropdownContainerElement).not.toHaveClass 'open' expect(Turbolinks.visit).toHaveBeenCalledWith linkedLocation
it 'should close on ESC keypress', -> it 'should close on ESC keypress', ->
expect(@dropdownContainerElement).toHaveClass 'open' expect(@dropdownContainerElement).toHaveClass 'open'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment