Commit 85a8c7ef authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add feature specs for project labels search

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 692d4795
......@@ -18,7 +18,7 @@
= _('Star a label to make it a priority label. Order the prioritized labels to change their relative priority, by dragging.')
= form_tag project_labels_path(@project), method: :get do
= search_field_tag :search, params[:search], { placeholder: _('Filter labels by name or description'), class: 'form-control', spellcheck: false }
= search_field_tag :search, params[:search], { placeholder: _('Filter labels by name or description'), id: 'label-search', class: 'form-control', spellcheck: false }
.labels-container.prepend-top-10
- if can_admin_label
......
require 'spec_helper'
describe 'Search for labels', :js do
let(:user) { create(:user) }
let(:project) { create(:project) }
let!(:label1) { create(:label, title: 'Foo', description: 'Lorem ipsum', project: project) }
let!(:label2) { create(:label, title: 'Bar', description: 'Fusce consequat', project: project) }
before do
project.add_maintainer(user)
sign_in(user)
end
it 'searches for label by title' do
visit project_labels_path(project)
fill_in 'label-search', with: 'Bar'
find('#label-search').native.send_keys(:enter)
expect(page).to have_content(label2.title)
expect(page).to have_content(label2.description)
expect(page).not_to have_content(label1.title)
expect(page).not_to have_content(label1.description)
end
it 'searches for label by title' do
visit project_labels_path(project)
fill_in 'label-search', with: 'Lorem'
find('#label-search').native.send_keys(:enter)
expect(page).to have_content(label1.title)
expect(page).to have_content(label1.description)
expect(page).not_to have_content(label2.title)
expect(page).not_to have_content(label2.description)
end
end
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