diff --git a/app/assets/javascripts/content_editor/components/wrappers/paragraph.vue b/app/assets/javascripts/content_editor/components/wrappers/paragraph.vue index 7dedf7cfbab6bb8c0832bd887c51431b6a450f45..628dd6d025d249f2d1058e8a83881504432751ba 100644 --- a/app/assets/javascripts/content_editor/components/wrappers/paragraph.vue +++ b/app/assets/javascripts/content_editor/components/wrappers/paragraph.vue @@ -57,11 +57,8 @@ export default { </script> <template> <editor-state-observer @transaction="updateNodeView"> - <node-view-wrapper - as="p" - :class="{ 'gl-flex gl-align-items-baseline': hasQuickActionExplanation }" - > - <node-view-content ref="nodeViewContent" as="span" /> + <node-view-wrapper :class="{ 'gl-flex gl-items-baseline': hasQuickActionExplanation }"> + <node-view-content ref="nodeViewContent" as="p" /> <span v-if="hasQuickActionExplanation" class="gl-text-sm gl-text-secondary gl-italic" diff --git a/spec/support/shared_examples/features/rich_text_editor/autocomplete_shared_examples.rb b/spec/support/shared_examples/features/rich_text_editor/autocomplete_shared_examples.rb index a83be822aa7a1a046174c21b62857c720417f035..3f64d064ebafe41f4d228a3c0b4bafad80deff9c 100644 --- a/spec/support/shared_examples/features/rich_text_editor/autocomplete_shared_examples.rb +++ b/spec/support/shared_examples/features/rich_text_editor/autocomplete_shared_examples.rb @@ -150,6 +150,23 @@ expect(page).to have_text('@abc123') end + it 'allows adding text before a username' do + type_in_content_editor '@abc' + + expect(find(suggestions_dropdown)).to have_text('abc123') + + send_keys :tab + expect(page).to have_text('@abc123') + + send_keys [:arrow_left, :arrow_left] + type_in_content_editor 'foo' + + sleep 0.1 # wait for the text to be added + switch_to_markdown_editor + + expect(page.find('textarea').value).to include('foo @abc123') + end + it 'allows dismissing the suggestion popup and typing more text' do type_in_content_editor '@ab'