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/frontend/dropzone_input_spec.js')
-rw-r--r--spec/frontend/dropzone_input_spec.js29
1 files changed, 28 insertions, 1 deletions
diff --git a/spec/frontend/dropzone_input_spec.js b/spec/frontend/dropzone_input_spec.js
index 12e10f7c5f4..11414e8890d 100644
--- a/spec/frontend/dropzone_input_spec.js
+++ b/spec/frontend/dropzone_input_spec.js
@@ -32,6 +32,8 @@ describe('dropzone_input', () => {
});
describe('handlePaste', () => {
+ let form;
+
const triggerPasteEvent = (clipboardData = {}) => {
const event = $.Event('paste');
const origEvent = new Event('paste');
@@ -45,11 +47,15 @@ describe('dropzone_input', () => {
beforeEach(() => {
loadFixtures('issues/new-issue.html');
- const form = $('#new_issue');
+ form = $('#new_issue');
form.data('uploads-path', TEST_UPLOAD_PATH);
dropzoneInput(form);
});
+ afterEach(() => {
+ form = null;
+ });
+
it('pastes Markdown tables', () => {
jest.spyOn(PasteMarkdownTable.prototype, 'isTable');
jest.spyOn(PasteMarkdownTable.prototype, 'convertToTableMarkdown');
@@ -86,6 +92,27 @@ describe('dropzone_input', () => {
expect(axiosMock.history.post[0].data.get('file').name).toHaveLength(246);
});
+ it('disables generated image file when clipboardData have both image and text', () => {
+ const TEST_PLAIN_TEXT = 'This wording is a plain text.';
+ triggerPasteEvent({
+ types: ['text/plain', 'Files'],
+ getData: () => TEST_PLAIN_TEXT,
+ items: [
+ {
+ kind: 'text',
+ type: 'text/plain',
+ },
+ {
+ kind: 'file',
+ type: 'image/png',
+ getAsFile: () => new Blob(),
+ },
+ ],
+ });
+
+ expect(form.find('.js-gfm-input')[0].value).toBe('');
+ });
+
it('display original file name in comment box', async () => {
const axiosMock = new MockAdapter(axios);
triggerPasteEvent({