Skip to content

Commit 3f581ec

Browse files
authored
Merge branch 'development' into tinymce-cleanup
2 parents d237cd4 + a025258 commit 3f581ec

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- 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.
55
- Fixed bar chart click function in the Usage dashboard (GitHub issue #3443)
66
- Fixed broken link for the V1 API documentation.
7+
- Fix `hidden_field_tag` Nested Attributes Format For Rails 7 Upgrade and Add Test Coverage [#3479](https://github.com/DMPRoadmap/roadmap/pull/3479)
78

89

910
**Note this upgrade is mainly a migration from Bootstrap 3 to Bootstrap 5.**

app/views/research_outputs/metadata_standards/_search_result.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<%# locals: result %>
22

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

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

app/views/research_outputs/repositories/_search_result.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
%>
44

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

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

spec/features/modal_search_spec.rb

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,35 @@
4949
click_link 'Remove'
5050
expect(page).not_to have_text(@model.description)
5151
end
52+
53+
it 'saves research output and selected repository association', :js do
54+
# Fill in required fields
55+
fill_in 'Title', with: 'Test Output'
56+
select 'Audiovisual', from: 'research_output_output_type'
57+
58+
# Open the modal and select repository
59+
click_button 'Add a repository'
60+
within('#modal-search-repositories') do
61+
fill_in 'research_output_search_term', with: @model.name
62+
click_button 'Apply filter(s)'
63+
click_link 'Select'
64+
# (execute_script('arguments[0].click();', modal_close_button) works locally here, but not as GitHub Action)
65+
find('[data-bs-dismiss="modal"]').click
66+
end
67+
68+
click_button 'Save'
69+
70+
# Verify UI changes
71+
expect(page).to have_css('.fas.fa-circle-check + span + span',
72+
text: 'Successfully added the researchoutput.')
73+
expect(page).to have_content('Test Output')
74+
expect(page).to have_content(@model.name)
75+
76+
# Verify DB changes
77+
research_output = ResearchOutput.last
78+
expect(research_output.title).to eq('Test Output')
79+
expect(research_output.output_type).to eq('audiovisual')
80+
expect(research_output.repositories).to include(@model)
81+
expect(research_output.plan).to eq(@plan)
82+
end
5283
end

0 commit comments

Comments
 (0)