2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
RSpec.describe 'Global search', :js, feature_category: :global_search do
|
2021-02-22 17:27:13 +05:30
|
|
|
include AfterNextHelpers
|
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
let_it_be(:user) { create(:user) }
|
|
|
|
let_it_be(:project) { create(:project, namespace: user.namespace) }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
2019-10-12 21:52:04 +05:30
|
|
|
end
|
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
describe 'when header search' do
|
2021-11-11 11:23:49 +05:30
|
|
|
before do
|
|
|
|
visit dashboard_projects_path
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'renders updated search bar' do
|
|
|
|
expect(page).to have_no_selector('.search-form')
|
|
|
|
expect(page).to have_selector('#js-header-search')
|
|
|
|
end
|
2022-01-26 12:08:38 +05:30
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
it 'focuses search input when shortcut "s" is pressed' do
|
2022-01-26 12:08:38 +05:30
|
|
|
expect(page).not_to have_selector('#search:focus')
|
|
|
|
|
|
|
|
find('body').native.send_key('s')
|
|
|
|
|
|
|
|
expect(page).to have_selector('#search:focus')
|
|
|
|
end
|
2019-09-04 21:01:54 +05:30
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|