diff --git a/app/views/staff/time_slots/create.turbo_stream.haml b/app/views/staff/time_slots/create.turbo_stream.haml index 624591d4a..187abf5f7 100644 --- a/app/views/staff/time_slots/create.turbo_stream.haml +++ b/app/views/staff/time_slots/create.turbo_stream.haml @@ -3,7 +3,7 @@ %turbo-stream{action: 'datatable-add', target: 'organizer-time-slots'} %template - = render(time_slot_decorated) + = render(partial: 'staff/time_slots/time_slot', formats: [:html], object: time_slot_decorated) = turbo_stream.update 'flash' do = show_flash diff --git a/app/views/staff/time_slots/update.turbo_stream.haml b/app/views/staff/time_slots/update.turbo_stream.haml index 592c417e6..4f1701795 100644 --- a/app/views/staff/time_slots/update.turbo_stream.haml +++ b/app/views/staff/time_slots/update.turbo_stream.haml @@ -2,7 +2,7 @@ %turbo-stream{action: 'datatable-update', target: 'organizer-time-slots', 'row-id': @time_slot.id} %template - = render(time_slot_decorated) + = render(partial: 'staff/time_slots/time_slot', formats: [:html], object: time_slot_decorated) = turbo_stream.update 'flash' do = show_flash diff --git a/spec/system/staff/time_slots_spec.rb b/spec/system/staff/time_slots_spec.rb new file mode 100644 index 000000000..d76bcf793 --- /dev/null +++ b/spec/system/staff/time_slots_spec.rb @@ -0,0 +1,25 @@ +require 'rails_helper' + +feature 'Staff Organizers can manage time slots', type: :system do + let(:event) { create(:event, start_date: Date.today, end_date: Date.today + 2.days) } + let!(:room) { create(:room, name: 'Main Hall', event: event) } + let!(:organizer_user) { create(:organizer, event: event) } + + before { login_as(organizer_user) } + + scenario 'creates a time slot via the "Save and Add" button', js: true do + visit event_staff_schedule_time_slots_path(event) + + click_link 'Add Time Slot' + + within('#time-slot-new-dialog') do + select '1', from: 'Day' + select 'Main Hall', from: 'Room' + click_button 'Save and Add' + end + + expect(page).to have_content('Time slot added.') + expect(event.time_slots.count).to eq(1) + expect(page).to have_css('#organizer-time-slots tbody tr') + end +end