Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Fixed a bug in the deep copy of plans where the old identifier was being copied into the new plan. We now copy the generated id of the new plan to the identifier field.
- Fixed bar chart click function in the Usage dashboard (GitHub issue #3443)
- Fixed broken link for the V1 API documentation.
- Fix `hidden_field_tag` Nested Attributes Format For Rails 7 Upgrade and Add Test Coverage [#3479](https://github.com/DMPRoadmap/roadmap/pull/3479)


**Note this upgrade is mainly a migration from Bootstrap 3 to Bootstrap 5.**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%# locals: result %>

<% if result.present? %>
<%= hidden_field_tag "research_output[metadata_standards_attributes[#{result.id}][id]]", result.id %>
<%= hidden_field_tag "research_output[metadata_standards_attributes][#{result.id}][id]", result.id %>

<p><%= sanitize(result.description) %></p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
%>

<% if result.present? %>
<%= hidden_field_tag "research_output[repositories_attributes[#{result.id}][id]]", result.id %>
<%= hidden_field_tag "research_output[repositories_attributes][#{result.id}][id]", result.id %>

<p><%= result.description %></p>

Expand Down
31 changes: 31 additions & 0 deletions spec/features/modal_search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,35 @@
click_link 'Remove'
expect(page).not_to have_text(@model.description)
end

it 'saves research output and selected repository association', :js do
# Fill in required fields
fill_in 'Title', with: 'Test Output'
select 'Audiovisual', from: 'research_output_output_type'

# Open the modal and select repository
click_button 'Add a repository'
within('#modal-search-repositories') do
fill_in 'research_output_search_term', with: @model.name
click_button 'Apply filter(s)'
click_link 'Select'
# (execute_script('arguments[0].click();', modal_close_button) works locally here, but not as GitHub Action)
find('[data-bs-dismiss="modal"]').click
end

click_button 'Save'

# Verify UI changes
expect(page).to have_css('.fas.fa-circle-check + span + span',
text: 'Successfully added the researchoutput.')
expect(page).to have_content('Test Output')
expect(page).to have_content(@model.name)

# Verify DB changes
research_output = ResearchOutput.last
expect(research_output.title).to eq('Test Output')
expect(research_output.output_type).to eq('audiovisual')
expect(research_output.repositories).to include(@model)
expect(research_output.plan).to eq(@plan)
end
end
Loading