Commit 689538b5 authored by Samantha Ming's avatar Samantha Ming

Ensure suggestion works for number text

Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/224143
parent 6da3c126
...@@ -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