|
1 |
# frozen_string_literal: true
|
|
2 |
|
|
3 |
# Redmine - project management software
|
|
4 |
# Copyright (C) 2006-2020 Jean-Philippe Lang
|
|
5 |
#
|
|
6 |
# This program is free software; you can redistribute it and/or
|
|
7 |
# modify it under the terms of the GNU General Public License
|
|
8 |
# as published by the Free Software Foundation; either version 2
|
|
9 |
# of the License, or (at your option) any later version.
|
|
10 |
#
|
|
11 |
# This program is distributed in the hope that it will be useful,
|
|
12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
# GNU General Public License for more details.
|
|
15 |
#
|
|
16 |
# You should have received a copy of the GNU General Public License
|
|
17 |
# along with this program; if not, write to the Free Software
|
|
18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
19 |
|
|
20 |
require File.expand_path('../../application_system_test_case', __FILE__)
|
|
21 |
|
|
22 |
class InlineAutocompleteSystemTest < ApplicationSystemTestCase
|
|
23 |
fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles,
|
|
24 |
:trackers, :projects_trackers, :enabled_modules, :issue_statuses, :issues,
|
|
25 |
:enumerations, :custom_fields, :custom_values, :custom_fields_trackers,
|
|
26 |
:watchers, :journals, :journal_details, :versions,
|
|
27 |
:workflows
|
|
28 |
|
|
29 |
def test_keyboard_shortcuts_to_switch_edit_preview_tabs
|
|
30 |
log_user('jsmith', 'jsmith')
|
|
31 |
visit 'issues/new'
|
|
32 |
|
|
33 |
fill_in 'Description', :with => 'new issue description'
|
|
34 |
|
|
35 |
# Switch to preview using control + shift + p
|
|
36 |
find('#issue_description').click.send_keys([:control, :shift, 'p'])
|
|
37 |
find 'div.wiki-preview', :visible => true, :text => 'new issue description'
|
|
38 |
|
|
39 |
# Switch to edit using control + shift + p
|
|
40 |
page.find('body').send_keys([:control, :shift, 'p'])
|
|
41 |
find 'div.wiki-preview', :visible => false
|
|
42 |
find 'textarea.wiki-edit', :visible => true
|
|
43 |
|
|
44 |
# Switch back to preview using command + shift + p
|
|
45 |
find('#issue_description').click.send_keys([:command, :shift, 'p'])
|
|
46 |
find 'div.wiki-preview', :visible => true, :text => 'new issue description'
|
|
47 |
|
|
48 |
# Switch to edit using control + shift + p
|
|
49 |
page.find('body').send_keys([:command, :shift, 'p'])
|
|
50 |
find 'div.wiki-preview', :visible => false
|
|
51 |
find 'textarea.wiki-edit', :visible => true
|
|
52 |
end
|
|
53 |
|
|
54 |
def test_keyboard_shortcuts_should_switch_to_edit_tab_the_last_previewed_tab
|
|
55 |
log_user('jsmith', 'jsmith')
|
|
56 |
visit 'issues/1/edit'
|
|
57 |
|
|
58 |
page.first(:link, 'Edit').click
|
|
59 |
# Preview issue description by clicking the Preview tab
|
|
60 |
page.find('#issue_description_and_toolbar').click_link('Preview')
|
|
61 |
find 'div#preview_issue_description', :visible => true
|
|
62 |
|
|
63 |
# Preview issue notes by clicking the Preview tab
|
|
64 |
page.find('fieldset:nth-child(3)').click_link('Preview')
|
|
65 |
find 'div#preview_issue_notes', :visible => true
|
|
66 |
|
|
67 |
page.find('body').send_keys([:command, :shift, 'p'])
|
|
68 |
find 'textarea#issue_notes', :visible => true
|
|
69 |
find 'div#preview_issue_notes', :visible => false
|
|
70 |
end
|
|
71 |
end
|