getEventSources.js 935 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. describe('getEventSources', function() {
  2. pushOptions({
  3. now: '2015-08-07',
  4. defaultView: 'agendaWeek',
  5. eventSources: [
  6. {
  7. events: [
  8. { id: 1, start: '2015-08-07T02:00:00', end: '2015-08-07T03:00:00', title: 'event A' }
  9. ]
  10. },
  11. {
  12. events: [
  13. { id: 2, start: '2015-08-07T03:00:00', end: '2015-08-07T04:00:00', title: 'event B' }
  14. ]
  15. },
  16. {
  17. events: [
  18. { id: 3, start: '2015-08-07T04:00:00', end: '2015-08-07T05:00:00', title: 'event C' }
  19. ]
  20. }
  21. ]
  22. })
  23. it('does not mutate when removeEventSource is called', function(done) {
  24. initCalendar()
  25. var eventSources = currentCalendar.getEventSources()
  26. expect(eventSources.length).toBe(3)
  27. // prove that eventSources is a copy, and wasn't mutated
  28. currentCalendar.removeEventSource(eventSources[0])
  29. expect(eventSources.length).toBe(3)
  30. done()
  31. })
  32. })