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/features/custom_fields/multi_user_custom_field_spe...

94 lines
2.4 KiB

require "spec_helper"
Boards module (#7008) * Hack spike to show D&D use case [ci skip] * Add ordered work packages * Save order on existing work packages * Boards WIP * CDK drag * Add dragula handler [ci skip] * Add filter to return all manual sorted work packages * Print icon on hover * Boards routing and list components * Better loading indicator on list with streaming result [ci skip] * Add new board and list buttons [ci skip] * Post new query [ci skip] * Added creation of new board lists with persisted queries [ci skip] * Render placeholder row in empty queries [ci skip] * Push boards on grid * Use base class in scope [ci skip] * Extend api for options * Hack spike to show D&D use case [ci skip] * Add ordered work packages * Save order on existing work packages * Boards WIP * CDK drag * Add dragula handler [ci skip] * Add filter to return all manual sorted work packages * Print icon on hover * Boards routing and list components * Better loading indicator on list with streaming result [ci skip] * Add new board and list buttons [ci skip] * Post new query [ci skip] * Added creation of new board lists with persisted queries [ci skip] * Render placeholder row in empty queries [ci skip] * Save queries in grids [ci skip] * Renaming queries [ci skip] * Add existing work packages to board [ci skip] * Introduce card view component for work packages * Extend grids to allow project scope for boards (#7025) Extends the grid backend to also be able to handle boards. In particular, it adds the ability of boards to be attached to projects and changes the page property of grids to a scope property that better describes that more than one board can belong to the same scope (e.g. /projects/:project_id/boards). For a fully featured board, though, widgets need to be able to store options, so that they can store queries. Those widgets might also need to have custom processing and validation. That part has not been implemented. * introduce project association for boards * have dedicated grid registration classes * update and create form for board grids * extract defaults into grid registration [ci skip] * Add drag and drop to card view [ci skip] * Add options to grid * Fix option migration name * Renaming boards [ci skip] * Frontend deletion of boards * Avoid map on NodeList which doesnt exist [ci skip] * Add inline create to boards [ci skip] * Smaller create button [ci skip] * Add navigation for boards * Make inner grid same height * Replace index page with table * Workaround for widget registration [ci skip] * Fixed height for cards and tables [ci skip] * Implement escape as cancel d&d action [ci skip] * Fix and extend grid specs for name and options * Extend board specs for required name * Fix migration for MySQL references https://stackoverflow.com/a/45825566/420614 * Make board list extend from widget Since we cannot configure widgets yet, it's not yet possible to use a board-list widget anywhere. * Fix specs * Fix escape listener removal [ci skip] * Fix renamed to_path in relation spec [ci skip] * Allow deletion of grids for boards * Avoid reloading resource multiple times with replays * Frontend synchronization on deletion [ci skip] * Delete through table * Use work packages board path * Use work packages board path * Fix augmented columns breaking re-rendering * Fix duplicated permission with forums * Strengthen tab switch in specs * Add hidden flag for project-context queries Allows the API to create a hidden query that will not be rendered to the user even if it is within a project context. * private queries * Add hidden flag for project-context queries Allows the API to create a hidden query that will not be rendered to the user even if it is within a project context. * Move boards below work packages * Add Board configuration modal * Fix reloading with onPush * Saving / Switching of display mode [ci skip] * Extract wp-query-selectable-title into common component * Fix renaming of board-list * Fix auto-hide notifications in boards * Add permissions to seeders * Reorder lists in board * Linting * Remove default gravatar from settings * Show assignees avatar in the card view of WPs * Fix specs * Add missing method * Fix timeline icon * Use URL as input to be able to show avatars for groups, too * Fix test * Add further specs * Use correct data attribute to avoid unnecessary data base calls * Add further specs * Deletion of board lists * Pass permission via gon to decide whether we can create boards * Fix rename spec * Cherry-pick of 7873d59 and 30abc7f
6 years ago
require "support/pages/work_packages/abstract_work_package"
describe "multi select custom values", js: true do
let(:type) { FactoryBot.create :type }
let(:project) { FactoryBot.create :project, types: [type] }
let(:custom_field) do
FactoryBot.create(
:user_wp_custom_field,
name: "Reviewer",
multi_value: true,
types: [type],
projects: [project]
)
end
let(:cf_edit_field) do
field = wp_page.edit_field "customField#{custom_field.id}"
field.field_type = 'ng-select'
field
end
let(:member_names) { ["Billy Nobbler", "Cooper Quatermaine", "Anton Lupin"] }
# We include an invited member to check at the same time that invited users are properly
# offered for user custom fields as they weren't before.
let(:member_statuses) do
[User::STATUSES[:active], User::STATUSES[:active], User::STATUSES[:invited]]
end
let(:members) do
member_names.zip(member_statuses).map do |name, status|
first, last = name.split(" ")
FactoryBot.create :user, firstname: first, lastname: last, status: status
end
end
let(:role) { FactoryBot.create :role }
let(:wp_page) { Pages::FullWorkPackage.new work_package }
let(:user) { FactoryBot.create :admin }
before do
members.each do |user|
project.add_member user, role
end
project.save!
end
context "with existing custom values" do
let(:work_package) do
wp = FactoryBot.build :work_package, project: project, type: type
wp.custom_field_values = {
custom_field.id => [members[0].id.to_s, members[2].id.to_s]
}
wp.save
wp
end
before do
login_as(user)
wp_page.visit!
wp_page.ensure_page_loaded
end
it "should be shown and allowed to be updated" do
expect(page).to have_text custom_field.name
expect(page).to have_text "Billy Nobbler"
expect(page).to have_text "Anton Lupin"
page.find(".wp-table--cell-span", text: "Billy Nobbler").click
cf_edit_field.unset_value "Anton Lupin", true
cf_edit_field.set_value "Cooper Quatermaine"
click_on "Reviewer: Save"
expect(page).to have_selector('.custom-option', count: 2)
expect(page).to have_text "Successful update"
expect(page).to have_text custom_field.name
expect(page).to have_text "Billy Nobbler"
expect(page).not_to have_text "Anton Lupin"
expect(page).to have_text "Cooper Quatermaine"
end
end
end