Commit e781c76a authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '224143-suggestion-button-not-work-for-numbers' into 'master'

Ensure suggestion works for number text

See merge request gitlab-org/gitlab!44332
parents 197fdddf 689538b5
...@@ -166,6 +166,7 @@ export function insertMarkdownText({ ...@@ -166,6 +166,7 @@ export function insertMarkdownText({
let editorSelectionEnd; let editorSelectionEnd;
let lastNewLine; let lastNewLine;
let textToInsert; let textToInsert;
selected = selected.toString();
if (editor) { if (editor) {
const selectionRange = getEditorSelectionRange(editor); const selectionRange = getEditorSelectionRange(editor);
......
---
title: Ensure suggestion works for number text
merge_request: 44332
author:
type: fixed
...@@ -13,6 +13,23 @@ describe('init markdown', () => { ...@@ -13,6 +13,23 @@ describe('init markdown', () => {
textArea.parentNode.removeChild(textArea); textArea.parentNode.removeChild(textArea);
}); });
describe('insertMarkdownText', () => {
it('will not error if selected text is a number', () => {
const selected = 2;
insertMarkdownText({
textArea,
text: '',
tag: '',
blockTag: null,
selected,
wrap: false,
});
expect(textArea.value).toBe(selected.toString());
});
});
describe('textArea', () => { describe('textArea', () => {
describe('without selection', () => { describe('without selection', () => {
it('inserts the tag on an empty line', () => { it('inserts the tag on an empty line', () => {
......
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