Commit 78a8a79b authored by Clement Ho's avatar Clement Ho Committed by Jacob Schatz

Fix dropzone project show

parent ea5221ae
import $ from 'jquery';
import initBlob from '~/blob_edit/blob_bundle';
import ShortcutsNavigation from '~/shortcuts_navigation';
import NotificationsForm from '~/notifications_form';
import UserCallout from '~/user_callout';
......@@ -19,10 +20,22 @@ document.addEventListener('DOMContentLoaded', () => {
className: 'js-autodevops-banner',
});
if ($('#tree-slider').length) new TreeView(); // eslint-disable-line no-new
if ($('.blob-viewer').length) new BlobViewer(); // eslint-disable-line no-new
if ($('.project-show-activity').length) new Activities(); // eslint-disable-line no-new
$('#tree-slider').waitForImages(() => {
// Project show page loads different overview content based on user preferences
const treeSlider = document.querySelector('#tree-slider');
if (treeSlider) {
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);
});
});
---
title: Fix file upload on project show page
merge_request:
author:
type: fixed
require 'spec_helper'
describe 'Project show page', :feature do
include DropzoneHelper
context 'when project pending delete' do
let(:project) { create(:project, :empty_repo, pending_delete: true) }
......@@ -334,4 +336,24 @@ describe 'Project show page', :feature do
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
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