2016-11-07 13:36:58 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
describe 'Global search' do
|
2016-11-07 13:36:58 -05:00
|
|
|
let(:user) { create(:user) }
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { create(:project, namespace: user.namespace) }
|
2016-11-07 13:36:58 -05:00
|
|
|
|
|
|
|
before do
|
2018-07-11 10:36:08 -04:00
|
|
|
project.add_maintainer(user)
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(user)
|
2016-11-07 13:36:58 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'I search through the issues and I see pagination' do
|
|
|
|
before do
|
|
|
|
allow_any_instance_of(Gitlab::SearchResults).to receive(:per_page).and_return(1)
|
|
|
|
create_list(:issue, 2, project: project, title: 'initial')
|
|
|
|
end
|
|
|
|
|
|
|
|
it "has a pagination" do
|
|
|
|
visit dashboard_projects_path
|
|
|
|
|
|
|
|
fill_in "search", with: "initial"
|
|
|
|
click_button "Go"
|
|
|
|
|
|
|
|
select_filter("Issues")
|
2018-01-23 06:03:15 -05:00
|
|
|
expect(page).to have_selector('.gl-pagination .next')
|
2016-11-07 13:36:58 -05:00
|
|
|
end
|
|
|
|
end
|
2019-05-24 15:20:05 -04:00
|
|
|
|
|
|
|
it 'closes the dropdown on blur', :js do
|
|
|
|
visit dashboard_projects_path
|
|
|
|
|
|
|
|
fill_in 'search', with: "a"
|
|
|
|
dropdown = find('.js-dashboard-search-options')
|
|
|
|
|
|
|
|
expect(dropdown[:class]).to include 'show'
|
|
|
|
|
|
|
|
find('#search').send_keys(:backspace)
|
|
|
|
find('body').click
|
|
|
|
|
|
|
|
expect(dropdown[:class]).not_to include 'show'
|
|
|
|
end
|
2016-11-07 13:36:58 -05:00
|
|
|
end
|