bootstrap3-datetimepicker-rails icon indicating copy to clipboard operation
bootstrap3-datetimepicker-rails copied to clipboard

not able to write feature test when datapickers are involved

Open Ana06 opened this issue 5 years ago • 0 comments

I am using bootstrap3-datetimepicker-rails 4.17.47, rspec 3.6.0 and capybara 3.12.0. I have tried several solutions to modify the datapickers in a feature test, but any of them worked:

  • page.execute_script("$('#registration-period-start-datapicker').datepicker('setDate', '01/01/2010')")
  • page.execute_script("$('#registration-period-start-datapicker'').val('21/12/1980')")
  • fill_in 'registration-period-start-datapicker', :with => '21/12/1980'
  • $('#registration-period-start-datapicker').datetimepicker({value: '21/12/1980'})
  • using capybara-bootstrap-datepicker, check https://github.com/akarzim/capybara-bootstrap-datepicker/issues/14

I have the following code in Rails:

= f.input :start_date, as: :string, input_html: { class: 'form-control', id: 'registration-period-start-datapicker' }

With this JavaScript:

$('#registration-period-start-datapicker').datetimepicker({
     format: 'YYYY-MM-DD',
     minDate : today,
     maxDate : end_conference
});

the generated html:

<div class="string input required stringish form-group" id="cfp_start_date_input"><span class="form-label"><label for="registration-period-start-datapicker" class=" control-label">Start date&nbsp;<span class="text-warning"><abbr title="This field is required">*</abbr></span></label></span><span class="form-wrapper"><input id="registration-period-start-datapicker" class="form-control form-control" type="text" name="cfp[start_date]"></span></div>

Original code in github.com/openSUSE/osem

Related to: https://github.com/TrevorS/bootstrap3-datetimepicker-rails/issues/36

Ana06 avatar Mar 06 '19 15:03 Ana06