Spec: Add spec for drag-and-drop in week view

Changes:
- Create spec 138866 "should make event all day..."
- Fix spec 138864 which broke with recent calendar updates
- Remove two skipped specs that have been replaced

Test Plan:
- Run specs

Change-Id: I0eb7d8c0fa2caed155f79cff26a8aef6d5b8e01b
Reviewed-on: https://gerrit.instructure.com/65778
Tested-by: Jenkins
Reviewed-by: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Michael Hargiss <mhargiss@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
This commit is contained in:
gbeckmann 2015-10-23 16:02:08 -06:00 committed by Matt Fairbourn
parent 62957a422c
commit 9bea92cae6
1 changed files with 36 additions and 30 deletions

View File

@ -79,20 +79,6 @@ describe "calendar2" do
expect(event.reload.end_at).to eql(noon + 1.hour + 5.minutes) expect(event.reload.end_at).to eql(noon + 1.hour + 5.minutes)
end end
it "should change duration of a short event when dragging resize handle" do
skip("dragging events doesn't seem to work")
noon = Time.zone.now.at_beginning_of_day + 12.hours
event = @course.calendar_events.create! :title => "ohai", :start_at => noon, :end_at => noon + 5.minutes
load_week_view
resize_handle = fj('.fc-event:visible .ui-resizable-handle')
driver.action.drag_and_drop_by(resize_handle, 0, 50).perform
wait_for_ajaximations
expect(event.reload.start_at).to eql(noon)
expect(event.end_at).to eql(noon + 1.hours + 30.minutes)
end
it "should show the right times in the tool tips for short events" do it "should show the right times in the tool tips for short events" do
noon = Time.zone.now.at_beginning_of_day + 12.hours noon = Time.zone.now.at_beginning_of_day + 12.hours
event = @course.calendar_events.create! :title => "ohai", :start_at => noon, :end_at => noon + 5.minutes event = @course.calendar_events.create! :title => "ohai", :start_at => noon, :end_at => noon + 5.minutes
@ -101,10 +87,6 @@ describe "calendar2" do
elt = fj('.fc-event:visible') elt = fj('.fc-event:visible')
expect(elt.attribute('title')).to match(/12:00.*12:05/) expect(elt.attribute('title')).to match(/12:00.*12:05/)
end end
it "should update the event as all day if dragged to all day row" do
skip("dragging events doesn't seem to work")
end
end end
it "should display correct dates after navigation arrow", priority: "1", test_id: 417600 do it "should display correct dates after navigation arrow", priority: "1", test_id: 417600 do
@ -186,19 +168,43 @@ describe "calendar2" do
expect(f('.ui-datepicker-calendar').text).to include_text("Mo") expect(f('.ui-datepicker-calendar').text).to include_text("Mo")
end end
# calendar markup has changed significantly making this more difficult to test it "should extend event time by dragging", priority: "1", test_id: 138864 do
# but it still works based on manual testing # Create event on current day at 9:00 AM in current time zone
# TODO: reimplement in a future PS midnight = Time.zone.now.beginning_of_day
event1 = make_event(start: midnight + 9.hour, end_at: midnight + 10.hours)
# it "should extend event time with dragging", priority: "1", test_id: 138864 do # Create an assignment at noon to be the drag target
# # Create event on current day at 1:00 AM in current time zone # This is a workaround because the rows do not have usable unique identifiers
# start_time = Time.zone.now.beginning_of_day + 1.hour @course.assignments.create!(name: 'Title', due_at: midnight + 12.hours)
# make_event(:start => start_time)
# load_week_view
# # Drag and drop to "Slot 11", which will result in event end at 6:00 AM # Drag and drop event resizer from first event onto assignment icon
# drag_and_drop_element(fj('.ui-resizable-handle'), fj('.fc-slot11')) load_week_view
# expect(fj('.fc-event-time')).to include_text('1:00 - 6:00') keep_trying_until { expect(ffj('.fc-view-container .icon-calendar-month').length).to eq 1 }
# end drag_and_drop_element(fj('.fc-end-resizer'), fj('.icon-assignment'))
# Verify Event now ends at assignment start time + 30 minutes
expect(event1.reload.end_at).to eql(midnight + 12.hours + 30.minutes)
end
it "should make event all-day by dragging", priority: "1", test_id: 138866 do
# Create an all-day event to act as drag target
# This is a workaround because the all-day row is positioned absolutely
midnight = Time.zone.now.beginning_of_day
make_event(title: 'Event1', start: midnight, all_day: true)
# Create a second event, starting at noon, to be drag object
event2 = make_event(title: 'Event2', start: midnight + 12.hours)
# Drag object event onto target event using calendar icons
load_week_view
keep_trying_until { expect(ffj('.fc-view-container .icon-calendar-month').length).to eq 2 }
icon_array = ffj('.fc-view-container .icon-calendar-month')
drag_and_drop_element(icon_array[1], icon_array[0])
wait_for_ajaximations
# Verify object event is now all-day
expect(event2.reload.all_day).to eql(true)
expect(event2.start_at).to eql(midnight)
end
end end
end end