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 basic tests for team planner module

Henriette Darge6a2263f1033c
diff --git a/config/locales/en.yml b/config/locales/en.yml
index d3d4d908928..8ca144c1126 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1685,6 +1685,10 @@ en:
label_member_plural: "Members"
lable_membership_added: 'Member added'
lable_membership_updated: 'Member updated'
+ label_menu_badge:
+ pre_alpha: 'pre-alpha'
+ alpha: 'alpha'
+ beta: 'beta'
label_menu_item_name: "Name of menu item"
label_message: "Message"
label_message_last: "Last message"
diff --git a/frontend/src/app/features/team-planner/team-planner/page/team-planner-page.component.ts b/frontend/src/app/features/team-planner/team-planner/page/team-planner-page.component.ts
index 10a475e04ea..43feae50f25 100644
--- a/frontend/src/app/features/team-planner/team-planner/page/team-planner-page.component.ts
+++ b/frontend/src/app/features/team-planner/team-planner/page/team-planner-page.component.ts
@@ -3,7 +3,6 @@ import {
ChangeDetectorRef,
Component,
Injector,
- OnInit,
} from '@angular/core';
import {
ToolbarButtonComponentDefinition,
diff --git a/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts
index 861960e32d1..82d22098ce6 100644
--- a/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts
+++ b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts
@@ -34,16 +34,15 @@ export class TeamPlannerComponent {
public calendarEventsFunction(fetchInfo:{ start:Date, end:Date, timeZone:string },
successCallback:(events:EventInput[]) => void,
failureCallback:(error:any) => void):void|PromiseLike<EventInput[]> {
-
successCallback([{
- title: "Important todo",
+ title: 'Important todo',
start: '2021-11-10',
end: '2021-11-21',
allDay: true,
}]);
}
- public buildHeader() {
+ public buildHeader():{ right:string, center:string, left:string } {
return {
right: 'dayGridMonth,dayGridWeek',
center: 'title',
diff --git a/modules/dashboards/config/locales/en.yml b/modules/dashboards/config/locales/en.yml
index 76837f43310..ecbc0c6db9e 100644
--- a/modules/dashboards/config/locales/en.yml
+++ b/modules/dashboards/config/locales/en.yml
@@ -1,6 +1,5 @@
en:
dashboards:
label: 'Dashboards'
- menu_badge: 'Alpha'
project_module_dashboards: 'Dashboards'
diff --git a/modules/dashboards/lib/dashboards/engine.rb b/modules/dashboards/lib/dashboards/engine.rb
index beed5b897ac..6796cd5424e 100644
--- a/modules/dashboards/lib/dashboards/engine.rb
+++ b/modules/dashboards/lib/dashboards/engine.rb
@@ -16,7 +16,7 @@ module Dashboards
after: :work_packages,
before: :calendar,
icon: 'icon2 icon-status',
- badge: 'dashboards.menu_badge')
+ badge: 'label_menu_badge.alpha')
end
end
diff --git a/modules/team_planner/config/routes.rb b/modules/team_planner/config/routes.rb
index b175df93065..102bb69f2fc 100644
--- a/modules/team_planner/config/routes.rb
+++ b/modules/team_planner/config/routes.rb
@@ -1,5 +1,5 @@
OpenProject::Application.routes.draw do
scope 'projects/:project_id', as: 'project' do
- get '/team_planner(/*state)', to: 'team_planner/team_planner#index'
+ get '/team_planner(/*state)', to: 'team_planner/team_planner#index', as: :team_planner
end
end
diff --git a/modules/team_planner/lib/open_project/team_planner/engine.rb b/modules/team_planner/lib/open_project/team_planner/engine.rb
index b37497434a2..2317381974a 100644
--- a/modules/team_planner/lib/open_project/team_planner/engine.rb
+++ b/modules/team_planner/lib/open_project/team_planner/engine.rb
@@ -27,7 +27,6 @@ module OpenProject::TeamPlanner
bundled: true,
settings: {},
name: 'OpenProject Team Planner' do
-
project_module :team_planner_view, dependencies: :work_package_tracking, order: 60 do
permission :view_team_planner, 'team_planner/team_planner': %i[index], dependencies: :view_work_packages
end
@@ -37,8 +36,8 @@ module OpenProject::TeamPlanner
{ controller: '/team_planner/team_planner', action: :index },
caption: :'team_planner.label_team_planner',
after: :backlogs,
- icon: 'icon2 icon-calendar'
+ icon: 'icon2 icon-calendar',
+ badge: 'label_menu_badge.pre_alpha'
end
-
end
end
diff --git a/modules/team_planner/spec/permissions/view_team_planner_spec.rb b/modules/team_planner/spec/permissions/view_team_planner_spec.rb
new file mode 100644
index 00000000000..8d6589c1ca7
--- /dev/null
+++ b/modules/team_planner/spec/permissions/view_team_planner_spec.rb
@@ -0,0 +1,36 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2021 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+require 'spec_helper'
+require 'support/permission_specs'
+
+describe TeamPlanner::TeamPlannerController, 'view_team_planner permission', type: :controller do
+ include PermissionSpecs
+
+ check_permission_required_for('team_planner/team_planner#index', :view_team_planner)
+end
diff --git a/modules/team_planner/spec/routing/team_planner_routing_spec.rb b/modules/team_planner/spec/routing/team_planner_routing_spec.rb
new file mode 100644
index 00000000000..fbe5418741f
--- /dev/null
+++ b/modules/team_planner/spec/routing/team_planner_routing_spec.rb
@@ -0,0 +1,37 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2021 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+require 'spec_helper'
+
+describe 'Team planner routing', type: :routing do
+ it 'routes to team_planner#index' do
+ is_expected
+ .to route(:get, '/projects/foobar/team_planner/state')
+ .to(controller: 'team_planner/team_planner', action: 'index', project_id: 'foobar', state: 'state')
+ end
+end