Commit 34c79388 authored by Phil Hughes's avatar Phil Hughes

Fixed issue edit shortcut not working

This was caused by the element getting cached on the class before the
Vue app has finished rendering.

Closes #43560
parent 7403ea37
...@@ -9,13 +9,12 @@ export default class ShortcutsIssuable extends Shortcuts { ...@@ -9,13 +9,12 @@ export default class ShortcutsIssuable extends Shortcuts {
super(); super();
this.$replyField = isMergeRequest ? $('.js-main-target-form #note_note') : $('.js-main-target-form .js-vue-comment-form'); this.$replyField = isMergeRequest ? $('.js-main-target-form #note_note') : $('.js-main-target-form .js-vue-comment-form');
this.editBtn = document.querySelector('.js-issuable-edit');
Mousetrap.bind('a', () => ShortcutsIssuable.openSidebarDropdown('assignee')); Mousetrap.bind('a', () => ShortcutsIssuable.openSidebarDropdown('assignee'));
Mousetrap.bind('m', () => ShortcutsIssuable.openSidebarDropdown('milestone')); Mousetrap.bind('m', () => ShortcutsIssuable.openSidebarDropdown('milestone'));
Mousetrap.bind('l', () => ShortcutsIssuable.openSidebarDropdown('labels')); Mousetrap.bind('l', () => ShortcutsIssuable.openSidebarDropdown('labels'));
Mousetrap.bind('r', this.replyWithSelectedText.bind(this)); Mousetrap.bind('r', this.replyWithSelectedText.bind(this));
Mousetrap.bind('e', this.editIssue.bind(this)); Mousetrap.bind('e', ShortcutsIssuable.editIssue);
if (isMergeRequest) { if (isMergeRequest) {
this.enabledHelp.push('.hidden-shortcut.merge_requests'); this.enabledHelp.push('.hidden-shortcut.merge_requests');
...@@ -58,10 +57,10 @@ export default class ShortcutsIssuable extends Shortcuts { ...@@ -58,10 +57,10 @@ export default class ShortcutsIssuable extends Shortcuts {
return false; return false;
} }
editIssue() { static editIssue() {
// Need to click the element as on issues, editing is inline // Need to click the element as on issues, editing is inline
// on merge request, editing is on a different page // on merge request, editing is on a different page
this.editBtn.click(); document.querySelector('.js-issuable-edit').click();
return false; return false;
} }
......
---
title: Fixed issue edit shortcut not opening edit form
merge_request:
author:
type: fixed
...@@ -271,6 +271,18 @@ describe 'New/edit issue', :js do ...@@ -271,6 +271,18 @@ describe 'New/edit issue', :js do
end end
end end
context 'inline edit' do
before do
visit project_issue_path(project, issue)
end
it 'opens inline edit form with shortcut' do
find('body').send_keys('e')
expect(page).to have_selector('.detail-page-description form')
end
end
describe 'sub-group project' do describe 'sub-group project' do
let(:group) { create(:group) } let(:group) { create(:group) }
let(:nested_group_1) { create(:group, parent: group) } let(:nested_group_1) { create(:group, parent: group) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment