mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 11:44:02 +00:00
Replace registration-period datepickers with date input
Nowadays all browsers have reasonable date input support...
This commit is contained in:
parent
f4d9561eaa
commit
07bfff8fa1
7 changed files with 39 additions and 68 deletions
|
|
@ -16,62 +16,31 @@ feature RegistrationPeriod do
|
|||
click_link 'New Registration Period'
|
||||
end
|
||||
|
||||
scenario 'requires start date and end date', feature: true do
|
||||
visit admin_conference_registration_period_path(conference_id: conference)
|
||||
click_link 'New Registration Period'
|
||||
|
||||
click_button 'Save Registration Period'
|
||||
page.find('#flash')
|
||||
expect(flash)
|
||||
.to eq('An error prohibited the Registration Period from being saved: ' \
|
||||
"Start date can't be blank. End date can't be blank.")
|
||||
end
|
||||
|
||||
context 'with tickets' do
|
||||
let!(:registration_ticket) do
|
||||
create(:registration_ticket, conference: conference)
|
||||
end
|
||||
|
||||
it 'creates registration period', feature: true, js: true do
|
||||
page
|
||||
.execute_script("$('#registration-period-start-datepicker').val('" +
|
||||
"#{start_date.strftime('%d/%m/%Y')}')")
|
||||
page
|
||||
.execute_script("$('#registration-period-end-datepicker').val('" +
|
||||
"#{end_date.strftime('%d/%m/%Y')}')")
|
||||
|
||||
fill_in 'registration_period_start_date', with: start_date.strftime('%Y/%m/%d')
|
||||
fill_in 'registration_period_end_date', with: end_date.strftime('%Y/%m/%d')
|
||||
click_button 'Save Registration Period'
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Registration Period successfully updated.')
|
||||
expect(current_path).to eq(admin_conference_registration_period_path(conference.short_title))
|
||||
expect(page).to have_text("Ticket required?\nYes")
|
||||
|
||||
registration_period = RegistrationPeriod.where(conference_id: conference.id).first
|
||||
registration_period.reload
|
||||
expect(registration_period.start_date).to eq(start_date)
|
||||
expect(registration_period.end_date).to eq(end_date)
|
||||
end
|
||||
end
|
||||
|
||||
context 'without tickets' do
|
||||
it 'creates registration period', feature: true, js: true do
|
||||
page
|
||||
.execute_script("$('#registration-period-start-datepicker').val('" +
|
||||
"#{start_date.strftime('%d/%m/%Y')}')")
|
||||
page
|
||||
.execute_script("$('#registration-period-end-datepicker').val('" +
|
||||
"#{end_date.strftime('%d/%m/%Y')}')")
|
||||
|
||||
fill_in 'registration_period_start_date', with: start_date.strftime('%Y-%m-%d')
|
||||
fill_in 'registration_period_end_date', with: end_date.strftime('%Y-%m-%d')
|
||||
click_button 'Save Registration Period'
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Registration Period successfully updated.')
|
||||
expect(current_path).to eq(admin_conference_registration_period_path(conference.short_title))
|
||||
expect(page).to have_text("Ticket required?\nNo")
|
||||
|
||||
registration_period = RegistrationPeriod.where(conference_id: conference.id).first
|
||||
registration_period.reload
|
||||
expect(registration_period.start_date).to eq(start_date)
|
||||
expect(registration_period.end_date).to eq(end_date)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue