Browse Source

Numeric question partial init

pull/21/head
Matthew Phelan 3 years ago
parent
commit
0614046049
  1. 4
      app/views/questions/_numeric_question.html.erb
  2. 11
      spec/views/questions/_numeric_question.html.erb_spec.rb

4
app/views/questions/_numeric_question.html.erb

@ -0,0 +1,4 @@
<div class="govuk-form-group">
<label for="numeric_input"><%= label %></label>
<input id="numeric_input" class="govuk-input govuk-input--width-20" type="number" />
</div>

11
spec/views/questions/_numeric_question.html.erb_spec.rb

@ -0,0 +1,11 @@
describe 'questions/_numeric_question.html.erb' do
context 'when given a label' do
let(:label) { "Test Label" }
it 'displays a numeric entry field' do
render :partial => 'numeric_question', locals: { label: label }
expect(rendered).to have_selector('//input[@type="number"]')
expect(rendered).to have_selector("//label[contains('#{label}')]")
end
end
end
Loading…
Cancel
Save