diff options
author | Jacob Schatz <jschatz@gitlab.com> | 2017-04-11 13:00:36 +0000 |
---|---|---|
committer | Jacob Schatz <jschatz@gitlab.com> | 2017-04-11 13:00:36 +0000 |
commit | 248c06a05cd7abb347e35c70ff573843ab15f329 (patch) | |
tree | 497a869b8b5fb26659427b323ef60c9e402a8aee | |
parent | 862b74bc4688bcd572b32d9998cbfbedec39e053 (diff) | |
parent | 195c058c1191fa4058176f511f1b6c52d0d7031f (diff) | |
download | gitlab-ce-248c06a05cd7abb347e35c70ff573843ab15f329.tar.gz |
Merge branch 'signed-out-menu-shortcuts' into 'master'
Added keyboard shortcuts to signed out menu
See merge request !10526
-rw-r--r-- | app/views/layouts/nav/_explore.html.haml | 19 | ||||
-rw-r--r-- | spec/features/dashboard/shortcuts_spec.rb | 48 |
2 files changed, 51 insertions, 16 deletions
diff --git a/app/views/layouts/nav/_explore.html.haml b/app/views/layouts/nav/_explore.html.haml index 3a1fcd00e9c..0cb367452f7 100644 --- a/app/views/layouts/nav/_explore.html.haml +++ b/app/views/layouts/nav/_explore.html.haml @@ -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 diff --git a/spec/features/dashboard/shortcuts_spec.rb b/spec/features/dashboard/shortcuts_spec.rb index fa5524e18d8..4c9adcabe34 100644 --- a/spec/features/dashboard/shortcuts_spec.rb +++ b/spec/features/dashboard/shortcuts_spec.rb @@ -1,27 +1,49 @@ require 'spec_helper' feature 'Dashboard shortcuts', feature: true, js: true do - before do - login_as :user - visit root_dashboard_path - end + 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') - scenario 'Navigate to tabs' do - find('body').native.send_keys([:shift, 'P']) + 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 - check_page_title('Projects') + context 'logged out' do + before do + visit explore_root_path + end - find('body').native.send_key([:shift, 'I']) + scenario 'Navigate to tabs' do + find('body').native.send_keys([:shift, 'P']) - check_page_title('Issues') + expect(page).to have_content('No projects found') - find('body').native.send_key([:shift, 'M']) + find('body').native.send_keys([:shift, 'G']) - check_page_title('Merge Requests') + expect(page).to have_content('No public groups') - find('body').native.send_keys([:shift, 'T']) + find('body').native.send_keys([:shift, 'S']) - check_page_title('Todos') + expect(page).to have_selector('.snippets-list-holder') + end end def check_page_title(title) |