Merge pull request #14282 from opf/bug/51279-breadcrumb-for-editing-custom-fields-is-missing

[#51279] Fix breadcrumb for editing custom fields is missing
This commit is contained in:
dominic-braeunlein
2023-11-30 10:55:19 +03:00
committed by GitHub
2 changed files with 22 additions and 4 deletions
+3 -4
View File
@@ -28,9 +28,8 @@
module BreadcrumbHelper
def full_breadcrumbs
items = breadcrumb_paths.compact
render(Primer::Beta::Breadcrumbs.new(test_selector: "op-breadcrumb" )) do |breadcrumbs|
items.each_with_index do |item, index|
render(Primer::Beta::Breadcrumbs.new(test_selector: "op-breadcrumb")) do |breadcrumbs|
breadcrumb_paths.each_with_index do |item, index|
item = anchor_string_to_object(item) if item.is_a?(String) && item.start_with?("\u003c")
if item.is_a?(Hash)
@@ -47,7 +46,7 @@ module BreadcrumbHelper
@breadcrumb_paths ||= [default_breadcrumb]
else
@breadcrumb_paths ||= []
@breadcrumb_paths += args
@breadcrumb_paths += args.flatten.compact
end
end
@@ -152,6 +152,18 @@ RSpec.describe 'custom fields', js: true, with_cuprite: true do
label_min_length, label_max_length, label_regexp,
label_possible_values, label_default_value)
end
it "shows the correct breadcrumbs" do
cf_page.visit_tab type
click_on "Create a new custom field"
wait_for_reload
page.within_test_selector('op-breadcrumb') do
expect(page).to have_selector('.breadcrumb-item', text: type)
expect(page).to have_selector('.breadcrumb-item.breadcrumb-item-selected', text: "New custom field")
end
end
end
describe 'projects' do
@@ -247,6 +259,13 @@ RSpec.describe 'custom fields', js: true, with_cuprite: true do
expect(page).to have_field("custom_field_custom_options_attributes_3_default_value", checked: true)
end
it "shows the correct breadcrumbs" do
page.within_test_selector('op-breadcrumb') do
expect(page).to have_selector('.breadcrumb-item', text: "Work packages")
expect(page).to have_selector('.breadcrumb-item.breadcrumb-item-selected', text: "Platform")
end
end
context "with work packages using the options" do
before do
create_list(