Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts/lib/utils/text_markdown_spec.js')
-rw-r--r--spec/javascripts/lib/utils/text_markdown_spec.js66
1 files changed, 56 insertions, 10 deletions
diff --git a/spec/javascripts/lib/utils/text_markdown_spec.js b/spec/javascripts/lib/utils/text_markdown_spec.js
index 73807350679..bb7a29fe30a 100644
--- a/spec/javascripts/lib/utils/text_markdown_spec.js
+++ b/spec/javascripts/lib/utils/text_markdown_spec.js
@@ -21,7 +21,14 @@ describe('init markdown', () => {
textArea.selectionStart = 0;
textArea.selectionEnd = 0;
- insertMarkdownText({ textArea, text: textArea.value, tag: '*', blockTag: null, selected: '', wrap: false });
+ insertMarkdownText({
+ textArea,
+ text: textArea.value,
+ tag: '*',
+ blockTag: null,
+ selected: '',
+ wrap: false,
+ });
expect(textArea.value).toEqual(`${initialValue}* `);
});
@@ -32,7 +39,14 @@ describe('init markdown', () => {
textArea.value = initialValue;
textArea.setSelectionRange(initialValue.length, initialValue.length);
- insertMarkdownText({ textArea, text: textArea.value, tag: '*', blockTag: null, selected: '', wrap: false });
+ insertMarkdownText({
+ textArea,
+ text: textArea.value,
+ tag: '*',
+ blockTag: null,
+ selected: '',
+ wrap: false,
+ });
expect(textArea.value).toEqual(`${initialValue}\n* `);
});
@@ -43,7 +57,14 @@ describe('init markdown', () => {
textArea.value = initialValue;
textArea.setSelectionRange(initialValue.length, initialValue.length);
- insertMarkdownText({ textArea, text: textArea.value, tag: '*', blockTag: null, selected: '', wrap: false });
+ insertMarkdownText({
+ textArea,
+ text: textArea.value,
+ tag: '*',
+ blockTag: null,
+ selected: '',
+ wrap: false,
+ });
expect(textArea.value).toEqual(`${initialValue}* `);
});
@@ -54,7 +75,14 @@ describe('init markdown', () => {
textArea.value = initialValue;
textArea.setSelectionRange(initialValue.length, initialValue.length);
- insertMarkdownText({ textArea, text: textArea.value, tag: '*', blockTag: null, selected: '', wrap: false });
+ insertMarkdownText({
+ textArea,
+ text: textArea.value,
+ tag: '*',
+ blockTag: null,
+ selected: '',
+ wrap: false,
+ });
expect(textArea.value).toEqual(`${initialValue}* `);
});
@@ -70,13 +98,27 @@ describe('init markdown', () => {
});
it('applies the tag to the selected value', () => {
- insertMarkdownText({ textArea, text: textArea.value, tag: '*', blockTag: null, selected, wrap: true });
+ insertMarkdownText({
+ textArea,
+ text: textArea.value,
+ tag: '*',
+ blockTag: null,
+ selected,
+ wrap: true,
+ });
expect(textArea.value).toEqual(text.replace(selected, `*${selected}*`));
});
it('replaces the placeholder in the tag', () => {
- insertMarkdownText({ textArea, text: textArea.value, tag: '[{text}](url)', blockTag: null, selected, wrap: false });
+ insertMarkdownText({
+ textArea,
+ text: textArea.value,
+ tag: '[{text}](url)',
+ blockTag: null,
+ selected,
+ wrap: false,
+ });
expect(textArea.value).toEqual(text.replace(selected, `[${selected}](url)`));
});
@@ -86,13 +128,15 @@ describe('init markdown', () => {
const select = 'url';
it('selects the text', () => {
- insertMarkdownText({ textArea,
+ insertMarkdownText({
+ textArea,
text: textArea.value,
tag,
blockTag: null,
selected,
wrap: false,
- select });
+ select,
+ });
const expectedText = text.replace(selected, `[${selected}](url)`);
@@ -106,13 +150,15 @@ describe('init markdown', () => {
textArea.value = initialValue;
const selectedIndex = initialValue.indexOf(selected);
textArea.setSelectionRange(selectedIndex, selectedIndex + selected.length);
- insertMarkdownText({ textArea,
+ insertMarkdownText({
+ textArea,
text: textArea.value,
tag,
blockTag: null,
selected,
wrap: false,
- select });
+ select,
+ });
const expectedText = initialValue.replace(selected, `[${selected}](url)`);