Adam Shaw před 4 roky
rodič
revize
128ce20a85

+ 23 - 0
packages/__tests__/src/icalendar/data/recurringWeeklyWithCount.ts

@@ -0,0 +1,23 @@
+export default `BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+METHOD:PUBLISH
+X-WR-CALNAME:[email protected]
+X-WR-TIMEZONE:Europe/Paris
+BEGIN:VEVENT
+DTSTART;TZID=Europe/Zurich:20190301T173000
+DTEND;TZID=Europe/Zurich:20190301T183000
+RRULE:FREQ=WEEKLY;WKST=MO;BYDAY=MO;COUNT=9
+DTSTAMP:20201006T124223Z
+ORGANIZER;CN=Testy McTestface:mailto:[email protected]
+UID:12345678
+CREATED:20181210T150458Z
+DESCRIPTION:
+LAST-MODIFIED:20190508T170523Z
+LOCATION:
+SEQUENCE:0
+STATUS:CONFIRMED
+SUMMARY:Weekly Monday meeting
+TRANSP:OPAQUE
+END:VEVENT
+END:VCALENDAR`

+ 19 - 0
packages/__tests__/src/icalendar/month-view.ts

@@ -9,6 +9,7 @@ import multipleMultidayEvents from './data/multipleMultidayEvents'
 import multipleEventsOneMunged from './data/multipleEventsOneMunged'
 import oneHourMeeting from './data/oneHourMeeting'
 import recurringWeeklyMeeting from './data/recurringWeeklyMeeting'
+import recurringWeeklyWithCount from './data/recurringWeeklyWithCount'
 import mungedOneHourMeeting from './data/mungedOneHourMeeting'
 
 describe('addICalEventSource with month view', () => {
@@ -56,6 +57,9 @@ describe('addICalEventSource with month view', () => {
   it('adds a one-hour long meeting', (done) => {
     loadICalendarWith(oneHourMeeting, () => {
       setTimeout(() => {
+        let events = currentCalendar.getEvents()
+        expect(events[0].start).toEqualDate('2019-04-15T09:30:00')
+        expect(events[0].end).toEqualDate('2019-04-15T10:30:00')
         assertEventCount(1)
         currentCalendar.getEvents().forEach((event) => expect(event.allDay).not.toBeTruthy())
         done()
@@ -66,12 +70,26 @@ describe('addICalEventSource with month view', () => {
   it('adds a repeating weekly meeting', (done) => {
     loadICalendarWith(recurringWeeklyMeeting, () => {
       setTimeout(() => {
+        let events = currentCalendar.getEvents()
+        expect(events[0].start).toEqualDate('2019-04-01T17:30:00')
         assertEventCount(6)
         done()
       }, 100)
     })
   })
 
+  // https://github.com/fullcalendar/fullcalendar/issues/6190
+  // this feed starts at beginning of previous month (March 2019) and has 9 total occurences,
+  // 5 of which will be visible in the current month (April 2019)
+  it('adds a repeating weekly meeting, limited by COUNT, but across months', (done) => {
+    loadICalendarWith(recurringWeeklyWithCount, () => {
+      setTimeout(() => {
+        assertEventCount(5)
+        done()
+      }, 100)
+    })
+  })
+
   it('ignores a munged event', (done) => {
     loadICalendarWith(mungedOneHourMeeting, () => {
       setTimeout(() => {
@@ -134,6 +152,7 @@ describe('addICalEventSource with month view', () => {
 
   // Checks to make sure all events have been rendered and that the calendar
   // has internal info on all the events.
+  // TODO: don't use currentCalendar
   function assertEventCount(expectedCount: number) {
     expect(currentCalendar.getEvents().length).toEqual(expectedCount)