Commit 45deb925 authored by Constance Okoghenun's avatar Constance Okoghenun Committed by Phil Hughes

Resolve "When editing a comment in an issue, the preview mode is toggled in the main textarea"

parent fe695ebd
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
methods: { methods: {
isValid(form) { isValid(form) {
return !form || return !form ||
form.find('.js-vue-markdown-field').length || form.find('.js-vue-markdown-field').length &&
$(this.$el).closest('form') === form[0]; $(this.$el).closest('form')[0] === form[0];
}, },
previewMarkdownTab(event, form) { previewMarkdownTab(event, form) {
......
---
title: Fixed bug when editing a comment in an issue,the preview mode is toggled in
the main textarea
merge_request: 20112
author: Constance Okoghenun
type: fixed
...@@ -63,6 +63,14 @@ describe "User comments on issue", :js do ...@@ -63,6 +63,14 @@ describe "User comments on issue", :js do
page.within(".current-note-edit-form") do page.within(".current-note-edit-form") do
fill_in("note[note]", with: comment) fill_in("note[note]", with: comment)
find('textarea').send_keys [:control, :shift, 'p']
expect(page).to have_selector('.current-note-edit-form .md-preview-holder')
expect(page.find('.current-note-edit-form .md-preview-holder p')).to have_content(comment)
end
expect(page).to have_selector('.new-note .note-textarea')
page.within(".current-note-edit-form") do
click_button("Save comment") click_button("Save comment")
end end
......
...@@ -51,7 +51,7 @@ describe('Markdown field header component', () => { ...@@ -51,7 +51,7 @@ describe('Markdown field header component', () => {
spyOn(vm, '$emit'); spyOn(vm, '$emit');
$(document).triggerHandler('markdown-preview:show', [ $(document).triggerHandler('markdown-preview:show', [
$('<form><textarea class="markdown-area"></textarea></textarea></form>'), $('<form><div class="js-vue-markdown-field"><textarea class="markdown-area"></textarea></div></form>'),
]); ]);
expect(vm.$emit).not.toHaveBeenCalled(); expect(vm.$emit).not.toHaveBeenCalled();
......
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