Commit f128cdb8 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add more specs to labels search feature

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 300f6aba
...@@ -9,11 +9,11 @@ describe 'Search for labels', :js do ...@@ -9,11 +9,11 @@ describe 'Search for labels', :js do
before do before do
project.add_maintainer(user) project.add_maintainer(user)
sign_in(user) sign_in(user)
end
it 'searches for label by title' do
visit project_labels_path(project) visit project_labels_path(project)
end
it 'searches for label by title' do
fill_in 'label-search', with: 'Bar' fill_in 'label-search', with: 'Bar'
find('#label-search').native.send_keys(:enter) find('#label-search').native.send_keys(:enter)
...@@ -24,8 +24,6 @@ describe 'Search for labels', :js do ...@@ -24,8 +24,6 @@ describe 'Search for labels', :js do
end end
it 'searches for label by title' do it 'searches for label by title' do
visit project_labels_path(project)
fill_in 'label-search', with: 'Lorem' fill_in 'label-search', with: 'Lorem'
find('#label-search').native.send_keys(:enter) find('#label-search').native.send_keys(:enter)
...@@ -34,4 +32,47 @@ describe 'Search for labels', :js do ...@@ -34,4 +32,47 @@ describe 'Search for labels', :js do
expect(page).not_to have_content(label2.title) expect(page).not_to have_content(label2.title)
expect(page).not_to have_content(label2.description) expect(page).not_to have_content(label2.description)
end end
it 'shows nothing found message' do
fill_in 'label-search', with: 'nonexistent'
find('#label-search').native.send_keys(:enter)
expect(page).to have_content('No labels with such name or description')
expect(page).not_to have_content(label1.title)
expect(page).not_to have_content(label1.description)
expect(page).not_to have_content(label2.title)
expect(page).not_to have_content(label2.description)
end
context 'priority labels' do
let!(:label_priority) { create(:label_priority, label: label1, project: project) }
it 'searches for priority label' do
fill_in 'label-search', with: 'Foo'
find('#label-search').native.send_keys(:enter)
page.within('.prioritized-labels') do
expect(page).to have_content(label1.title)
expect(page).to have_content(label1.description)
end
page.within('.other-labels') do
expect(page).to have_content('No labels with such name or description')
end
end
it 'searches for other label' do
fill_in 'label-search', with: 'Bar'
find('#label-search').native.send_keys(:enter)
page.within('.prioritized-labels') do
expect(page).to have_content('No labels with such name or description')
end
page.within('.other-labels') do
expect(page).to have_content(label2.title)
expect(page).to have_content(label2.description)
end
end
end
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