Commit fde871b8 authored by Marcel van Remmerden's avatar Marcel van Remmerden Committed by Miguel Rincon

Fix required data for referenced commands

Changelog: fixed
parent 469ed24f
......@@ -376,6 +376,7 @@ export default {
<div
v-if="referencedCommands && previewMarkdown && !markdownPreviewLoading"
class="referenced-commands"
data-testid="referenced-commands"
v-html="referencedCommands /* eslint-disable-line vue/no-v-html */"
></div>
<div v-if="shouldShowReferencedUsers" class="referenced-users">
......
......@@ -233,7 +233,7 @@ module IssuablesHelper
canUpdate: can?(current_user, :"update_#{issuable.to_ability_name}", issuable),
canDestroy: can?(current_user, :"destroy_#{issuable.to_ability_name}", issuable),
issuableRef: issuable.to_reference,
markdownPreviewPath: preview_markdown_path(parent),
markdownPreviewPath: preview_markdown_path(parent, target_type: issuable.model_name, target_id: issuable.iid),
markdownDocsPath: help_page_path('user/markdown'),
lockVersion: issuable.lock_version,
issuableTemplateNamesPath: template_names_path(parent, issuable),
......
......@@ -39,7 +39,7 @@ RSpec.describe IssuablesHelper do
issuesWebUrl: "/groups/#{@group.full_path}/-/issues",
lockVersion: epic.lock_version,
markdownDocsPath: '/help/user/markdown',
markdownPreviewPath: "/groups/#{@group.full_path}/preview_markdown",
markdownPreviewPath: "/groups/#{@group.full_path}/preview_markdown?target_id=#{epic.iid}&target_type=Epic",
projectsEndpoint: "/api/v4/groups/#{@group.id}/projects",
updateEndpoint: "/groups/#{@group.full_path}/-/epics/#{epic.iid}.json"
}
......
......@@ -71,6 +71,12 @@ RSpec.describe "User creates issue" do
expect(preview).to have_css("gl-emoji")
expect(textarea).not_to be_visible
click_button("Write")
fill_in("Description", with: "/confidential")
click_button("Preview")
expect(form).to have_content('Makes this issue confidential.')
end
end
end
......
......@@ -35,6 +35,12 @@ RSpec.describe "Issues > User edits issue", :js do
end
expect(form).to have_button("Write")
click_button("Write")
fill_in("Description", with: "/confidential")
click_button("Preview")
expect(form).to have_content('Makes this issue confidential.')
end
it 'allows user to select unassigned' do
......
......@@ -101,6 +101,21 @@ describe('Markdown field component', () => {
expect(subject.find('.zen-backdrop textarea').element).not.toBeNull();
});
it('renders referenced commands on markdown preview', async () => {
axiosMock
.onPost(markdownPreviewPath)
.reply(200, { references: { users: [], commands: 'test command' } });
previewLink = getPreviewLink();
previewLink.vm.$emit('click', { target: {} });
await axios.waitFor(markdownPreviewPath);
const referencedCommands = subject.find('[data-testid="referenced-commands"]');
expect(referencedCommands.exists()).toBe(true);
expect(referencedCommands.text()).toContain('test command');
});
describe('markdown preview', () => {
beforeEach(() => {
axiosMock.onPost(markdownPreviewPath).reply(200, { body: previewHTML });
......
......@@ -288,7 +288,7 @@ RSpec.describe IssuablesHelper do
canUpdate: true,
canDestroy: true,
issuableRef: "##{issue.iid}",
markdownPreviewPath: "/#{@project.full_path}/preview_markdown",
markdownPreviewPath: "/#{@project.full_path}/preview_markdown?target_id=#{issue.iid}&target_type=Issue",
markdownDocsPath: '/help/user/markdown',
lockVersion: issue.lock_version,
projectPath: @project.path,
......
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