Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Add spec to drop something on activity

Oliver Günther01f99785c595
diff --git a/frontend/src/app/features/work-packages/components/work-package-comment/work-package-comment.component.html b/frontend/src/app/features/work-packages/components/work-package-comment/work-package-comment.component.html
index 373e08371fe..6e69ca07885 100644
--- a/frontend/src/app/features/work-packages/components/work-package-comment/work-package-comment.component.html
+++ b/frontend/src/app/features/work-packages/components/work-package-comment/work-package-comment.component.html
@@ -19,6 +19,7 @@
<div
*ngIf="!active"
(dragover)="startDragOverActivation($event)"
+ (dragenter)="startDragOverActivation($event)"
>
<button
class="work-package-comment inline-edit--display-field"
diff --git a/spec/features/work_packages/attachments/attachment_upload_spec.rb b/spec/features/work_packages/attachments/attachment_upload_spec.rb
index d1f6d653ee4..48495841295 100644
--- a/spec/features/work_packages/attachments/attachment_upload_spec.rb
+++ b/spec/features/work_packages/attachments/attachment_upload_spec.rb
@@ -32,7 +32,7 @@ require 'features/page_objects/notification'
describe 'Upload attachment to work package', js: true do
let(:role) do
create :role,
- permissions: %i[view_work_packages add_work_packages edit_work_packages]
+ permissions: %i[view_work_packages add_work_packages edit_work_packages add_work_package_notes]
end
let(:dev) do
create :user,
@@ -194,6 +194,17 @@ describe 'Upload attachment to work package', js: true do
wp_page.expect_tab 'Files'
end
+ it 'can drag something from the files tab and create a comment with it' do
+ wp_page.switch_to_tab(tab: 'files')
+
+ attachments.drag_and_drop_file '.work-package-comment',
+ image_fixture.path,
+ :center,
+ page.find('[data-qa-tab-id="activity"]')
+
+ wp_page.expect_tab 'Activity'
+ end
+
it 'can upload an image via attaching and drag & drop' do
wp_page.switch_to_tab(tab: 'files')
container = page.find('.wp-attachment-upload')
diff --git a/spec/support/components/attachments/attachments_input.js b/spec/support/components/attachments/attachments_input.js
index f8bc3a38895..adb52da6c1b 100644
--- a/spec/support/components/attachments/attachments_input.js
+++ b/spec/support/components/attachments/attachments_input.js
@@ -92,7 +92,10 @@ let input = jQuery('<input>')
console.log("Dispatching event %O", event);
stopover.dispatchEvent(event);
});
+
+ setTimeout(() => dropOnTarget(dataTransfer), 2000);
+ } else {
+ dropOnTarget(dataTransfer);
}
- setTimeout(() => dropOnTarget(dataTransfer), 2000);
});