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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Merge remote-tracking branch 'origin/dev' into merge-release/16.0-20250604034740
ulferts6b09de338473
diff --cc spec/features/custom_fields/hierarchy_custom_field_spec.rbindex d6b3da45cdd,319a1685c3d..c8bcd094e20--- a/spec/features/custom_fields/hierarchy_custom_field_spec.rb+++ b/spec/features/custom_fields/hierarchy_custom_field_spec.rb@@@ -159,38 -158,55 +158,90 @@@ RSpec.describe "custom fields of type h# endregionend+ it "lets you add sub-items through the context menu" do+ custom_field = create(:hierarchy_wp_custom_field, name: "Imperial Organization")+ root = custom_field.hierarchy_root++ root.children.create(label: "Stormtroopers", short: "ST")+ root.children.create(label: "Imperial Navy", short: "IN")++ login_as admin+ custom_field_index_page.visit!++ hierarchy_page.add_custom_field_state(custom_field)+ click_on custom_field.name++ hierarchy_page.switch_tab "Items"+ hierarchy_page.expect_current_path+ expect(page).not_to have_test_selector("op-custom-fields--hierarchy-items-blankslate")+ expect(page).to have_test_selector("op-custom-fields--hierarchy-item", count: 2)++ hierarchy_page.open_action_menu_for("Stormtroopers")+ click_on "Add sub-item"++ expect(page).to have_test_selector("op-custom-fields--new-item-form")+ fill_in "Label", with: "Snowtroopers"+ fill_in "Short", with: "SnT"+ click_on "Save"++ expect(page).to have_test_selector("op-custom-fields--hierarchy-item", count: 1)+ expect(page).to have_test_selector("op-custom-fields--hierarchy-item", text: "Snowtroopers")++ within('[data-test-selector="hierarchy-breadcrumbs"]') { click_on "Imperial Organization" }+ expect(page).to have_test_selector("op-custom-fields--hierarchy-item", count: 2)+ expect(page).to have_test_selector("op-custom-fields--hierarchy-item", text: "Imperial Navy")+ expect(page).to have_test_selector("op-custom-fields--hierarchy-item", text: "Stormtroopers\n(ST)\n1 sub-item")+ end+++ context "when navigating the hierarchy" do+ let(:service) { CustomFields::Hierarchy::HierarchicalItemService.new }+ let(:custom_field) { create(:wp_custom_field, name: "Hogwarts", field_format: "hierarchy", hierarchy_root: nil) }+ let!(:root) { service.generate_root(custom_field).value! }+ let!(:ravenclaw) { service.insert_item(parent: root, label: "Ravenclaw").value! }+ let!(:slytherin) { service.insert_item(parent: root, label: "Slytherin").value! }+ let!(:hufflepuff) { service.insert_item(parent: root, label: "Hufflepuff").value! }+ let!(:gryffindor) { service.insert_item(parent: root, label: "Gryffindor").value! }+ let!(:luna) { service.insert_item(parent: ravenclaw, label: "Luna Lovegood").value! }+ let!(:harry) { service.insert_item(parent: gryffindor, label: "Harry Potter").value! }+ let!(:hermione) { service.insert_item(parent: gryffindor, label: "Hermione Granger").value! }+ let(:tree_view) { Components::TreeView.new }++ before do+ custom_field.reload+ hierarchy_page.add_custom_field_state(custom_field)+ visit custom_field_item_path(root.custom_field_id, gryffindor)+ end++ it "can navigate and keep the tab selection (regression #63921)" do+ # Expect items to be loaded and the tab nav to be selected correctly+ expect(page).to have_test_selector("op-custom-fields--hierarchy-item", count: 2)+ hierarchy_page.expect_tab "Items"++ # Navigating to an item will keep the tab nav selection+ page.find_test_selector("op-custom-fields--hierarchy-item", text: "Hermione Granger").click+ hierarchy_page.expect_tab "Items"+ end++ it "can use the TreeView for navigation" do+ expect(page).to have_test_selector("op-custom-fields--hierarchy-item", count: 2)++ # Expect the current item to be selected+ tree_view.should_have_active_item("Gryffindor")++ # All other nodes are collapsed initially+ tree_view.should_have_collapsed_node("Ravenclaw")++ # Navigate to another item+ tree_view.open_node "Ravenclaw"+ tree_view.click_node "Luna Lovegood"++ # Expect tree and page to update+ tree_view.should_have_active_item("Luna Lovegood")+ tree_view.should_have_open_node("Ravenclaw")+ tree_view.should_have_collapsed_node("Gryffindor")++ expect(page).to have_test_selector("op-custom-fields--hierarchy-item", count: 0)+ hierarchy_page.expect_tab "Items"+ end+ endend