Commit 0b62f58b authored by Jacob Schatz's avatar Jacob Schatz

Merge branch 'fix-dropzone-project-show' into 'master'

Fix dropzone project show

Closes #44137

See merge request gitlab-org/gitlab-ce!17784
parents ea5221ae 78a8a79b
import $ from 'jquery'; import $ from 'jquery';
import initBlob from '~/blob_edit/blob_bundle';
import ShortcutsNavigation from '~/shortcuts_navigation'; import ShortcutsNavigation from '~/shortcuts_navigation';
import NotificationsForm from '~/notifications_form'; import NotificationsForm from '~/notifications_form';
import UserCallout from '~/user_callout'; import UserCallout from '~/user_callout';
...@@ -19,10 +20,22 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -19,10 +20,22 @@ document.addEventListener('DOMContentLoaded', () => {
className: 'js-autodevops-banner', className: 'js-autodevops-banner',
}); });
if ($('#tree-slider').length) new TreeView(); // eslint-disable-line no-new // Project show page loads different overview content based on user preferences
if ($('.blob-viewer').length) new BlobViewer(); // eslint-disable-line no-new const treeSlider = document.querySelector('#tree-slider');
if ($('.project-show-activity').length) new Activities(); // eslint-disable-line no-new if (treeSlider) {
$('#tree-slider').waitForImages(() => { new TreeView(); // eslint-disable-line no-new
initBlob();
}
if (document.querySelector('.blob-viewer')) {
new BlobViewer(); // eslint-disable-line no-new
}
if (document.querySelector('.project-show-activity')) {
new Activities(); // eslint-disable-line no-new
}
$(treeSlider).waitForImages(() => {
ajaxGet(document.querySelector('.js-tree-content').dataset.logsPath); ajaxGet(document.querySelector('.js-tree-content').dataset.logsPath);
}); });
}); });
---
title: Fix file upload on project show page
merge_request:
author:
type: fixed
require 'spec_helper' require 'spec_helper'
describe 'Project show page', :feature do describe 'Project show page', :feature do
include DropzoneHelper
context 'when project pending delete' do context 'when project pending delete' do
let(:project) { create(:project, :empty_repo, pending_delete: true) } let(:project) { create(:project, :empty_repo, pending_delete: true) }
...@@ -334,4 +336,24 @@ describe 'Project show page', :feature do ...@@ -334,4 +336,24 @@ describe 'Project show page', :feature do
end end
end end
end end
describe 'dropzone', :js do
let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
before do
project.add_master(user)
sign_in(user)
visit project_path(project)
end
it 'can upload files' do
find('.add-to-tree').click
click_link 'Upload file'
drop_in_dropzone(File.join(Rails.root, 'spec', 'fixtures', 'doc_sample.txt'))
expect(find('.dz-filename')).to have_content('doc_sample.txt')
end
end
end end
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