diff options
Diffstat (limited to 'spec/features/global_search_spec.rb')
-rw-r--r-- | spec/features/global_search_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/features/global_search_spec.rb b/spec/features/global_search_spec.rb index a380edff3a4..0397e72502a 100644 --- a/spec/features/global_search_spec.rb +++ b/spec/features/global_search_spec.rb @@ -57,6 +57,14 @@ RSpec.describe 'Global search' do expect(page).to have_selector('.search-form') expect(page).to have_no_selector('#js-header-search') end + + it 'focuses search input when shortcut "s" is pressed', :js do + expect(page).not_to have_selector('#search:focus') + + find('body').native.send_key('s') + + expect(page).to have_selector('#search:focus') + end end describe 'when new_header_search feature is enabled' do @@ -70,5 +78,13 @@ RSpec.describe 'Global search' do expect(page).to have_no_selector('.search-form') expect(page).to have_selector('#js-header-search') end + + it 'focuses search input when shortcut "s" is pressed', :js do + expect(page).not_to have_selector('#search:focus') + + find('body').native.send_key('s') + + expect(page).to have_selector('#search:focus') + end end end |