Skip to content

Commit

Permalink
Merge pull request #4293 from sanger/Y24-111-set-default-values-to-null
Browse files Browse the repository at this point in the history
Y24 111 set default values to null
  • Loading branch information
sabrine33 authored Aug 23, 2024
2 parents a601903 + 310bbcb commit 6339926
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/views/receptacles/new_request.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<% instance_variable_or_id_param(:request_type) do |field_name, value| %>
<div class="form-group col-xs-12">
<%= label_tag(field_name, 'Request type', class: 'col-md-4') %>
<%= select_field_sorted_by_name(field_name, @request_types, value, can_edit) %>
<%= select_field_sorted_by_name(field_name, @request_types, value, can_edit, prompt: 'Select a request type', required: true) %>
</div>
<% end %>
<% if @asset.studies.uniq.count > 1 -%>
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/metadata/edit/_request.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<%- request.request_metadata.field_infos.each do |field_info| %>
<!-- todo unify with how submission use field info-->
<%- if field_info.selection %>
<%= metadata_fields.select(field_info.key, field_info.selection) %>
<%= metadata_fields.select(field_info.key, field_info.selection, { prompt: "Select a #{field_info.key.to_s.gsub( '_', ' ')}" }) %>
<%- elsif field_info.kind == FieldInfo::BOOLEAN %>
<%= metadata_fields.check_box(field_info.key) %>
<%- elsif field_info.kind == FieldInfo::NUMERIC %>
Expand Down
28 changes: 28 additions & 0 deletions spec/features/assets/asset_submission_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,34 @@
create(request_factory, study: study, project: project, asset: asset, request_type: original_request_type)
end

describe 'The request form does not set default values' do
let(:user) { create :admin }

before do
login_user user
visit labware_path(asset)
click_link 'Request additional sequencing'
end

describe 'when the form is loaded' do
it 'does not set request type' do
expect(page).to have_select('Request type', selected: 'Select a request type')
end
end

describe 'when the user selects a request type' do
before { select 'Request Type 1', from: 'Request type' }

it 'does not set flowcell type to default value' do
expect(page).to have_select('Flowcell type', selected: 'Select a requested flowcell type')
end

it 'does not set read length to default value' do
expect(page).to have_select('Read length', selected: 'Select a read length')
end
end
end

shared_examples 'it allows additional sequencing' do
it 'request additional sequencing' do
login_user user
Expand Down

0 comments on commit 6339926

Please sign in to comment.