diff options
author | Luke "Jared" Bennett <lbennett@gitlab.com> | 2016-07-08 02:00:45 +0100 |
---|---|---|
committer | Luke Bennett <lukeeeebennettplus@gmail.com> | 2016-08-18 18:17:56 +0100 |
commit | 1ac5f764cecdeaa4b41a77353a979f941cf0e72b (patch) | |
tree | a3d703289c065361f7696b7204b9fa557542c677 | |
parent | 40d869eefa2c491446b6aa75ec1337add6ce3e4a (diff) | |
download | gitlab-ce-1ac5f764cecdeaa4b41a77353a979f941cf0e72b.tar.gz |
Fixed test turbolink condition
-rw-r--r-- | app/assets/javascripts/gl_dropdown.js.coffee | 10 | ||||
-rw-r--r-- | spec/javascripts/gl_dropdown_spec.js.coffee | 7 |
2 files changed, 9 insertions, 8 deletions
diff --git a/app/assets/javascripts/gl_dropdown.js.coffee b/app/assets/javascripts/gl_dropdown.js.coffee index 4e439e0de84..5e626b148f3 100644 --- a/app/assets/javascripts/gl_dropdown.js.coffee +++ b/app/assets/javascripts/gl_dropdown.js.coffee @@ -307,7 +307,7 @@ class GitLabDropdown shouldPropagate: (e) => $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() false else @@ -380,10 +380,10 @@ class GitLabDropdown html = '' # 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 - return '<li class='separator'></li>' if data is 'separator' + return '<li class="separator"></li>' if data is 'separator' # Header return _.template('<li class="dropdown-header"><%- header %></li>')({ header: data.header }) if data.header? @@ -518,8 +518,8 @@ class GitLabDropdown addInput: (fieldName, value)-> # Create hidden input for form $input = $('<input>').attr('type', 'hidden') - .attr('name', fieldName) - .val(value) + .attr('name', fieldName) + .val(value) if @options.inputId? $input.attr('id', @options.inputId) diff --git a/spec/javascripts/gl_dropdown_spec.js.coffee b/spec/javascripts/gl_dropdown_spec.js.coffee index 46a0af32a7d..a4b3f519745 100644 --- a/spec/javascripts/gl_dropdown_spec.js.coffee +++ b/spec/javascripts/gl_dropdown_spec.js.coffee @@ -81,11 +81,12 @@ describe 'Dropdown', -> navigateWithKeys 'down', randomIndex, => spyOn(Turbolinks, 'visit').and.stub() navigateWithKeys 'enter', null, => + expect(@dropdownContainerElement).not.toHaveClass 'open' link = $("#{ITEM_SELECTOR}:eq(#{randomIndex}) a", @dropdownMenuElement) expect(link).toHaveClass 'is-active' - if link.attr 'href' - expect(Turbolinks.visit).toHaveBeenCalledWith link.attr 'href' - expect(@dropdownContainerElement).not.toHaveClass 'open' + linkedLocation = link.attr 'href' + if linkedLocation and linkedLocation isnt '#' + expect(Turbolinks.visit).toHaveBeenCalledWith linkedLocation it 'should close on ESC keypress', -> expect(@dropdownContainerElement).toHaveClass 'open' |