OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/spec_legacy/unit/lib/redmine_spec.rb

88 lines
3.4 KiB

#-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
#
# 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-2017 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 docs/COPYRIGHT.rdoc for more details.
#++
require 'legacy_spec_helper'
module RedmineMenuTestHelper
# Assertions
def assert_number_of_items_in_menu(menu_name, count)
assert Redmine::MenuManager.items(menu_name).size >= count, "Menu has less than #{count} items"
end
def assert_menu_contains_item_named(menu_name, item_name)
assert Redmine::MenuManager.items(menu_name).map(&:name).include?(item_name.to_sym), "Menu did not have an item named #{item_name}"
end
# Helpers
def get_menu_item(menu_name, item_name)
Redmine::MenuManager.items(menu_name).find { |item| item.name == item_name.to_sym }
end
end
describe Redmine do
include RedmineMenuTestHelper
it 'should top_menu' do
assert_number_of_items_in_menu :top_menu, 5
assert_menu_contains_item_named :top_menu, :work_packages
assert_menu_contains_item_named :top_menu, :news
assert_menu_contains_item_named :top_menu, :time_sheet
# do not test :projects here. it does not appear in the top_menu data structure, but will be generated by the TopMenuHelper
assert_menu_contains_item_named :top_menu, :help
end
it 'should account_menu' do
assert_number_of_items_in_menu :account_menu, 4
assert_menu_contains_item_named :account_menu, :administration
assert_menu_contains_item_named :account_menu, :my_account
assert_menu_contains_item_named :account_menu, :my_page
assert_menu_contains_item_named :account_menu, :logout
end
it 'should application_menu' do
assert_number_of_items_in_menu :application_menu, 0
end
it 'should admin_menu' do
assert_number_of_items_in_menu :admin_menu, 0
end
it 'should project_menu' do
[27828] Feature: Query menu in sidenav (#6429) * in main menu add gantt as extra work package child item * Satisfy spec and code climate * Add gantt chart icon behin default gantt query name. * WIP Query menu in left sidebar * Shift query dropdown in left sidenav * Reload menu or load query on click from every project location * WIP set correct label for default queries * Query menu listens on all changes of queries (delete, create, rename, toggle starred) and updates immediatly * WIP: Inline edit, field validation * Inline Edit validation and comfirm * Inline edit: validation of duplicate name * Set default columns and sorting for static queries * Codeclimate issues fixed * WIP Inline edit validation not working perfectly in all error states * Inline edit working * Autocompleter hover disabled and hovering over categories fixed * Category hover and toggle fixed; tested in Chrome, Firefox and Opera * Placeholder cut off fixed and text wrap added * English and german wording adjusted * Styles of inline edit and menu adjusted; matching wiki page styles * prevent menus to be displayed to often * application menu only displayed on work package * specify using no_menu layout more often * adapt tests to altered production implementation * Hamburger icon only in project; on global wp page: default queries shown correctly and summary removed * searching for undefined leads to error * Accessible click fixed (listen on escape) * Gantt in top menu deleted (gantt chart is part of default queries on wp page) * load menu on wp summary page * reduce times queries are loaded * lowercase on second word * remove menu from search and home * Styles fixed (category toggle and correct highlighting) * reflect static query in url * fix autocomplete handling in specs * Open all global menus on default and hide hamburger icon on global pages; Rebuild changes that have been ovrwritten after merge" * Correct highlighting of default queries after reload * Replace summary cuke with spec * WIP * Clear up selectors * Avoid actively setting promises and instead use $state.go to load links [ci skip] * Make editable title component a little simpler We can reuse the component I built for the wiki, that wasn't present in the frontend beforehand. * Fix moving through the menu and selecting items [ci skip] * Add save button to query title when query changed * Improve static names lookup by comparing query_props * Adapt and fix specs * Allow inner scrolling of wp query results Also, style the webkit scrollbar to make it pretty where supported * Allow renaming the query through setting menu, but simply focus on field [ci skip]
6 years ago
assert_number_of_items_in_menu :project_menu, 13
assert_menu_contains_item_named :project_menu, :overview
assert_menu_contains_item_named :project_menu, :activity
assert_menu_contains_item_named :project_menu, :roadmap
assert_menu_contains_item_named :project_menu, :work_packages
assert_menu_contains_item_named :project_menu, :calendar
assert_menu_contains_item_named :project_menu, :news
assert_menu_contains_item_named :project_menu, :forums
assert_menu_contains_item_named :project_menu, :repository
assert_menu_contains_item_named :project_menu, :settings
end
end