2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-11-03 12:29:30 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe 'Projects > Files > Find file keyboard shortcuts', :js do
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:project) { create(:project, :repository) }
|
2022-04-04 11:22:00 +05:30
|
|
|
let(:user) { project.first_owner }
|
2016-11-03 12:29:30 +05:30
|
|
|
|
|
|
|
before do
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in user
|
2016-11-03 12:29:30 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
visit project_find_file_path(project, project.repository.root_ref)
|
2016-11-03 12:29:30 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
wait_for_requests
|
2016-11-03 12:29:30 +05:30
|
|
|
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-08-17 22:00:37 +05:30
|
|
|
page.within('.js-file-title') do
|
2016-11-03 12:29:30 +05:30
|
|
|
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-08-17 22:00:37 +05:30
|
|
|
page.within('.js-file-title') do
|
2016-11-03 12:29:30 +05:30
|
|
|
expect(page).to have_content('application.js')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|