Added keyboard shortcuts to signed out menu

This commit is contained in:
Phil Hughes 2017-04-07 09:46:31 +01:00
parent ce6a48cbd0
commit 195c058c11
2 changed files with 51 additions and 16 deletions

View File

@ -1,16 +1,29 @@
%ul
= nav_link(path: ['dashboard#show', 'root#show', 'projects#trending', 'projects#starred', 'projects#index'], html_options: {class: 'home'}) do
= link_to explore_root_path, title: 'Projects' do
= link_to explore_root_path, title: 'Projects', class: 'dashboard-shortcuts-projects' do
.shortcut-mappings
.key
= icon('arrow-up', 'aria-label' => 'hidden')
P
%span
Projects
= nav_link(controller: [:groups, 'groups/milestones', 'groups/group_members']) do
= link_to explore_groups_path, title: 'Groups' do
= link_to explore_groups_path, title: 'Groups', class: 'dashboard-shortcuts-groups' do
.shortcut-mappings
.key
= icon('arrow-up', 'aria-label' => 'hidden')
G
%span
Groups
= nav_link(controller: :snippets) do
= link_to explore_snippets_path, title: 'Snippets' do
= link_to explore_snippets_path, title: 'Snippets', class: 'dashboard-shortcuts-snippets' do
.shortcut-mappings
.key
= icon('arrow-up', 'aria-label' => 'hidden')
S
%span
Snippets
%li.divider
= nav_link(controller: :help) do
= link_to help_path, title: 'Help' do
%span

View File

@ -1,27 +1,49 @@
require 'spec_helper'
feature 'Dashboard shortcuts', feature: true, js: true do
before do
login_as :user
visit root_dashboard_path
context 'logged in' do
before do
login_as :user
visit root_dashboard_path
end
scenario 'Navigate to tabs' do
find('body').native.send_keys([:shift, 'P'])
check_page_title('Projects')
find('body').native.send_key([:shift, 'I'])
check_page_title('Issues')
find('body').native.send_key([:shift, 'M'])
check_page_title('Merge Requests')
find('body').native.send_keys([:shift, 'T'])
check_page_title('Todos')
end
end
scenario 'Navigate to tabs' do
find('body').native.send_keys([:shift, 'P'])
context 'logged out' do
before do
visit explore_root_path
end
check_page_title('Projects')
scenario 'Navigate to tabs' do
find('body').native.send_keys([:shift, 'P'])
find('body').native.send_key([:shift, 'I'])
expect(page).to have_content('No projects found')
check_page_title('Issues')
find('body').native.send_keys([:shift, 'G'])
find('body').native.send_key([:shift, 'M'])
expect(page).to have_content('No public groups')
check_page_title('Merge Requests')
find('body').native.send_keys([:shift, 'S'])
find('body').native.send_keys([:shift, 'T'])
check_page_title('Todos')
expect(page).to have_selector('.snippets-list-holder')
end
end
def check_page_title(title)