gitlab-org--gitlab-foss/spec/features/projects/files/find_file_keyboard_spec.rb

41 lines
973 B
Ruby
Raw Normal View History

require 'spec_helper'
feature 'Find file keyboard shortcuts', js: true do
let(:user) { create(:user) }
let(:project) { create(:project, :repository) }
before do
project.team << [user, :master]
sign_in user
visit project_find_file_path(project, project.repository.root_ref)
wait_for_requests
end
it 'opens file when pressing enter key' do
fill_in 'file_find', with: 'CHANGELOG'
find('#file_find').native.send_keys(:enter)
expect(page).to have_selector('.blob-content-holder')
2017-02-05 17:28:48 -05:00
page.within('.js-file-title') do
expect(page).to have_content('CHANGELOG')
end
end
it 'navigates files with arrow keys' do
fill_in 'file_find', with: 'application.'
find('#file_find').native.send_keys(:down)
find('#file_find').native.send_keys(:enter)
expect(page).to have_selector('.blob-content-holder')
2017-02-05 17:28:48 -05:00
page.within('.js-file-title') do
expect(page).to have_content('application.js')
end
end
end