Added tests

This commit is contained in:
Phil Hughes 2016-06-09 10:44:17 +01:00
parent e796555bdb
commit d301791c2a
3 changed files with 18 additions and 3 deletions

View file

@ -67,9 +67,9 @@ module DropdownsHelper
end
end
def dropdown_filter(placeholder)
def dropdown_filter(placeholder, search_id: nil)
content_tag :div, class: "dropdown-input" do
filter_output = search_field_tag nil, nil, class: "dropdown-input-field", placeholder: placeholder
filter_output = search_field_tag search_id, nil, class: "dropdown-input-field", placeholder: placeholder
filter_output << icon('search', class: "dropdown-input-search")
filter_output << icon('times', class: "dropdown-input-clear js-dropdown-input-clear", role: "button")

View file

@ -4,7 +4,7 @@
- filter_placeholder = local_assigns.fetch(:filter_placeholder, 'Search labels')
.dropdown-page-one
= dropdown_title(title)
= dropdown_filter(filter_placeholder)
= dropdown_filter(filter_placeholder, search_id: "label-name")
= dropdown_content
- if @project && show_footer
= dropdown_footer do

View file

@ -199,4 +199,19 @@ feature 'Issue filtering by Labels', feature: true do
end
end
end
context 'dropdown filtering', js: true do
it 'should filter by label name' do
page.within '.labels-filter' do
click_button 'Label'
wait_for_ajax
fill_in 'label-name', with: 'bug'
page.within '.dropdown-content' do
expect(page).not_to have_content 'enhancement'
expect(page).to have_content 'bug'
end
end
end
end
end