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 test cases for "Mark as read" button on split- and full view. * Allow scrolling for split create form

Henriette Darge459972b5d286
diff --git a/frontend/src/app/features/work-packages/components/wp-buttons/wp-mark-notification-button/work-package-mark-notification-button.component.ts b/frontend/src/app/features/work-packages/components/wp-buttons/wp-mark-notification-button/work-package-mark-notification-button.component.ts
index de1631841a3..0fc61f64c30 100644
--- a/frontend/src/app/features/work-packages/components/wp-buttons/wp-mark-notification-button/work-package-mark-notification-button.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-buttons/wp-mark-notification-button/work-package-mark-notification-button.component.ts
@@ -1,4 +1,6 @@
-import { Component, ChangeDetectionStrategy, Input, OnInit } from '@angular/core';
+import {
+ Component, ChangeDetectionStrategy, Input, OnInit,
+} from '@angular/core';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { InAppNotificationsService } from 'core-app/features/in-app-notifications/store/in-app-notifications.service';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
diff --git a/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.html b/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.html
index 9697077b46c..8394796944b 100644
--- a/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.html
+++ b/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.html
@@ -34,6 +34,7 @@
<op-work-package-mark-notification-button
[workPackage]="workPackage"
buttonClasses="toolbar-icon"
+ data-qa-selector="mark-notification-read-button"
>
</op-work-package-mark-notification-button>
</li>
diff --git a/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.component.ts b/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.component.ts
index aded989e169..278e1a94749 100644
--- a/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.component.ts
+++ b/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.component.ts
@@ -26,7 +26,9 @@
// See docs/COPYRIGHT.rdoc for more details.
//++
-import { ChangeDetectionStrategy, Component, Injector, OnInit } from '@angular/core';
+import {
+ ChangeDetectionStrategy, Component, Injector, OnInit,
+} from '@angular/core';
import { StateService } from '@uirouter/core';
import { WorkPackageViewFocusService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-focus.service';
import { States } from 'core-app/core/states/states.service';
@@ -107,7 +109,7 @@ export class WorkPackageSplitViewComponent extends WorkPackageSingleViewBase imp
});
}
- get shouldFocus() {
+ get shouldFocus():boolean {
return this.$state.params.focus === true;
}
diff --git a/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.html b/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.html
index 87e948f84fc..cfbe403432a 100644
--- a/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.html
+++ b/frontend/src/app/features/work-packages/routing/wp-split-view/wp-split-view.html
@@ -14,6 +14,7 @@
class="work-packages--details-button"
[workPackage]="workPackage"
buttonClasses="-round"
+ data-qa-selector="mark-notification-read-button"
></op-work-package-mark-notification-button>
</div>
diff --git a/frontend/src/global_styles/content/work_packages/new/_split_view.sass b/frontend/src/global_styles/content/work_packages/new/_split_view.sass
index fb725d8e762..4970cdb0554 100644
--- a/frontend/src/global_styles/content/work_packages/new/_split_view.sass
+++ b/frontend/src/global_styles/content/work_packages/new/_split_view.sass
@@ -2,6 +2,8 @@
// Override the top header in create mode
&.-create-mode
top: 0
+ overflow-y: auto
+
// Details header containing switch icon and status|type row
.work-packages--new-details-header
margin: 0.375em 0
diff --git a/spec/features/work_packages/tabs/activity_notifications_spec.rb b/spec/features/work_packages/tabs/activity_notifications_spec.rb
index a7f8083bb1d..c31b29ddd21 100644
--- a/spec/features/work_packages/tabs/activity_notifications_spec.rb
+++ b/spec/features/work_packages/tabs/activity_notifications_spec.rb
@@ -20,14 +20,8 @@ describe 'Activity tab notifications', js: true, selenium: true do
work_package
end
shared_let(:admin) { FactoryBot.create(:admin) }
- shared_let(:full_view) { Pages::FullWorkPackage.new(work_package, project) }
- before do
- login_as(admin)
- full_view.visit!
- end
-
- context 'when there are notifications for the work package' do
+ shared_examples_for 'when there are notifications for the work package' do
shared_let(:notification) do
FactoryBot.create :notification,
recipient: admin,
@@ -35,24 +29,65 @@ describe 'Activity tab notifications', js: true, selenium: true do
resource: work_package,
journal: work_package.journals.last
end
-
- it 'Shows a notification bubble with the right number' do
+ it 'shows a notification bubble with the right number' do
expect(page).to have_selector('[data-qa-selector="tab-counter-Activity"]', text: '1')
end
- it 'Shows a notification icon next to activities that have an unread notification' do
+ it 'shows a notification icon next to activities that have an unread notification' do
expect(page).to have_selector('[data-qa-selector="user-activity-bubble"]', count: 1)
expect(page).to have_selector('[data-qa-activity-number="3"] [data-qa-selector="user-activity-bubble"]')
end
+
+ it 'shows a button to mark the notifications as read' do
+ expect(page).to have_selector('[data-qa-selector="mark-notification-read-button"]')
+
+ # A click marks the notification as read ...
+ page.find('[data-qa-selector="mark-notification-read-button"]').click
+
+ # ... and updates the view accordingly
+ expect(page).not_to have_selector('[data-qa-selector="mark-notification-read-button"]')
+ expect(page).not_to have_selector('[data-qa-selector="tab-counter-Activity"]')
+ expect(page).not_to have_selector('[data-qa-selector="user-activity-bubble"]')
+ end
end
- context 'when there are no notifications for the work package' do
- it 'Shows no notification bubble' do
+ shared_examples_for 'when there are no notifications for the work package' do
+ it 'shows no notification bubble' do
expect(page).not_to have_selector('[data-qa-selector="tab-counter-Activity"]')
end
- it 'Does not show any notification icons next to activities' do
+ it 'does not show any notification icons next to activities' do
expect(page).not_to have_selector('[data-qa-selector="user-activity-bubble"]')
end
+
+ it 'shows no button to mark the notifications as read' do
+ expect(page).not_to have_selector('[data-qa-selector="mark-notification-read-button"]')
+ end
+ end
+
+ context 'when on full view' do
+ shared_let(:full_view) { Pages::FullWorkPackage.new(work_package, project) }
+
+ before do
+ login_as(admin)
+ full_view.visit_tab! 'activity'
+ end
+
+ it_behaves_like 'when there are notifications for the work package'
+
+ it_behaves_like 'when there are no notifications for the work package'
+ end
+
+ context 'when on split view' do
+ shared_let(:split_view) { Pages::SplitWorkPackage.new(work_package, project) }
+
+ before do
+ login_as(admin)
+ split_view.visit_tab! 'activity'
+ end
+
+ it_behaves_like 'when there are notifications for the work package'
+
+ it_behaves_like 'when there are no notifications for the work package'
end
end