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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-12-15 12:10:00 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-12-15 12:10:00 +0300
commita79324ad1f94b0c497a89c1ee35bd7d33f318008 (patch)
tree51758517c955d805e343b5b640724964100219f9 /spec/frontend/blob_edit
parent4f33294e27e82f7d281c7ff7e390aa6c2ea32cb9 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/blob_edit')
-rw-r--r--spec/frontend/blob_edit/edit_blob_spec.js24
1 files changed, 20 insertions, 4 deletions
diff --git a/spec/frontend/blob_edit/edit_blob_spec.js b/spec/frontend/blob_edit/edit_blob_spec.js
index 0ac379e03c9..9637ea09a3a 100644
--- a/spec/frontend/blob_edit/edit_blob_spec.js
+++ b/spec/frontend/blob_edit/edit_blob_spec.js
@@ -12,13 +12,18 @@ describe('Blob Editing', () => {
const useMock = jest.fn();
const mockInstance = {
use: useMock,
- getValue: jest.fn(),
+ setValue: jest.fn(),
+ getValue: jest.fn().mockReturnValue('test value'),
focus: jest.fn(),
};
beforeEach(() => {
- setFixtures(
- `<div class="js-edit-blob-form"><div id="file_path"></div><div id="editor"></div><input id="file-content"></div>`,
- );
+ setFixtures(`
+ <form class="js-edit-blob-form">
+ <div id="file_path"></div>
+ <div id="editor"></div>
+ <textarea id="file-content"></textarea>
+ </form>
+ `);
jest.spyOn(EditorLite.prototype, 'createInstance').mockReturnValue(mockInstance);
});
afterEach(() => {
@@ -55,4 +60,15 @@ describe('Blob Editing', () => {
expect(EditorMarkdownExtension).toHaveBeenCalledTimes(1);
});
});
+
+ it('adds trailing newline to the blob content on submit', async () => {
+ const form = document.querySelector('.js-edit-blob-form');
+ const fileContentEl = document.getElementById('file-content');
+
+ await initEditor();
+
+ form.dispatchEvent(new Event('submit'));
+
+ expect(fileContentEl.value).toBe('test value\n');
+ });
});