TrevorS / bootstrap3-datetimepicker-rails

This gem packages the bootstrap-datetimepicker for the Rails 3.1+ asset pipeline.
MIT License
292 stars 123 forks source link

not able to write feature test when datapickers are involved #66

Open Ana06 opened 5 years ago

Ana06 commented 5 years ago

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:

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