Browse Source

lots of test fixes

Adam Shaw 6 years ago
parent
commit
133c53be4b

+ 1 - 1
packages-premium

@@ -1 +1 @@
-Subproject commit 06645d6f2b4567f2c2eaf67e3c69981d48c27f8c
+Subproject commit 5a2162ee9404918d8413c3bb88aae9883e4ab7a8

+ 4 - 4
packages/__tests__/src/event-data/Event.mutation.js

@@ -4,7 +4,7 @@ describe('event mutations on non-instances', function() {
     defaultView: 'dayGridWeek',
     now: '2018-09-03',
     events: [
-      { id: '1', start: '2018-09-04', rendering: 'inverse-background' }
+      { id: '1', start: '2018-09-04', rendering: 'inverse-background' } // will make two segs
     ]
   })
 
@@ -15,12 +15,12 @@ describe('event mutations on non-instances', function() {
       initCalendar({
         eventRender(arg) {
           renderCnt++
-          if (renderCnt === 1) {
+          if (renderCnt === 2) {
             arg.event.moveStart('-01:00')
             arg.event.moveEnd('01:00')
             arg.event.moveDates({ days: 1 })
             arg.event.setAllDay(false)
-          } else if (renderCnt === 2) {
+          } else if (renderCnt === 4) {
             arg.event.setStart('2018-08-04')
             arg.event.setEnd('2018-10-04')
             arg.event.setDates('2018-08-04', '2018-10-04')
@@ -28,7 +28,7 @@ describe('event mutations on non-instances', function() {
         }
       })
 
-      expect(renderCnt).toBe(2)
+      expect(renderCnt).toBe(4)
 
       let event = currentCalendar.getEventById('1')
       expect(event.start).toEqualDate('2018-09-04')

+ 3 - 11
packages/__tests__/src/event-render/DayGridEventRenderUtils.js

@@ -10,23 +10,15 @@ opts:
   - isStart
   - isEnd
 */
-export function directionallyTestSeg(opts, dir) {
+export function directionallyTestSeg(opts) {
   var el = opts.el ? $(opts.el) : getFirstEventEl()
 
   var row = opts.row || 0
   var rowTds = getDayGridRowDayElAtIndex(row)
   expect(rowTds.length).toBeGreaterThan(1)
 
-  var leftCol
-  var rightCol
-  if (dir === 'rtl') {
-    leftCol = rowTds.length - opts.lastCol - 1
-    rightCol = rowTds.length - opts.firstCol - 1
-  } else {
-    leftCol = opts.firstCol
-    rightCol = opts.lastCol
-  }
-
+  var leftCol = opts.firstCol
+  var rightCol = opts.lastCol
   var col, td
 
   for (col = leftCol; col <= rightCol; col++) {

+ 1 - 1
packages/__tests__/src/event-render/maxTime.js

@@ -42,7 +42,7 @@ describe('event rendering with maxTime', function() {
       lastCol: 6,
       isStart: true,
       isEnd: true
-    }, 'ltr')
+    })
   })
 
 })

+ 1 - 1
packages/__tests__/src/legacy/DayGrid-events.js

@@ -187,7 +187,7 @@ describe('DayGrid event rendering', function() {
     function testSeg(calendarOptions, testSegOptions) {
       calendarOptions.dir = dir
       initCalendar(calendarOptions)
-      directionallyTestSeg(testSegOptions, dir)
+      directionallyTestSeg(testSegOptions)
     }
   }
 

+ 4 - 4
packages/__tests__/src/legacy/ListView.js

@@ -7,9 +7,9 @@ import {
   getListEventEls,
   getListEventElsCount,
   getListEventElTimeText,
-  getListEventElTitle
+  getListEventElTitle,
+  getListViewScrollerEl
 } from '../lib/ListViewUtils'
-import { getScrollerEl } from '../lib/MonthViewUtils'
 import { replaceEventElDotElWithEl } from '../event-render/EventRenderUtils'
 
 describe('ListView rendering', function() {
@@ -455,7 +455,7 @@ describe('ListView rendering', function() {
       initCalendar({
         header: false
       }, $el)
-      let $scrollEl = getScrollerEl()
+      let $scrollEl = getListViewScrollerEl()
       expect(
         $scrollEl[0].scrollHeight
       ).toBeGreaterThan(
@@ -470,7 +470,7 @@ describe('ListView rendering', function() {
         header: false,
         height: 'auto'
       }, $el)
-      let $scrollEl = getScrollerEl()
+      let $scrollEl = getListViewScrollerEl()
       expect(
         Math.abs($scrollEl[0].scrollHeight - $scrollEl[0].clientHeight)
       ).toBeLessThan(2)

+ 28 - 33
packages/__tests__/src/legacy/aspectRatio.js

@@ -12,14 +12,14 @@ describe('aspectRatio', function() {
 
     it('view div should use the ratio 1:35 to set height', function() {
       initCalendar({}, getCalendarElement(elementWidth))
-      var height = getViewContainerEl().height()
-      expect(Math.round(height)).toEqual(500)
+      var rect = getViewContainerEl().getBoundingClientRect()
+      expect(Math.round(rect.height)).toEqual(500)
     })
 
     it('view div should have width of div', function() {
       initCalendar({}, getCalendarElement(elementWidth))
-      var width = getViewContainerEl().width()
-      expect(Math.round(width)).toEqual(elementWidth)
+      var rect = getViewContainerEl().getBoundingClientRect()
+      expect(Math.round(rect.width)).toEqual(elementWidth)
     })
 
   })
@@ -36,15 +36,14 @@ describe('aspectRatio', function() {
 
       it('should not change the width', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = getViewContainerEl().width()
-        expect(Math.round(width)).toEqual(elementWidth)
+        var rect = getViewContainerEl().getBoundingClientRect()
+        expect(Math.round(rect.width)).toEqual(elementWidth)
       })
 
       it('should set the height to width sizes very close to ratio of 2', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = getViewContainerEl().width()
-        var height = getViewContainerEl().height()
-        var ratio = Math.round(width / height * 100)
+        var rect = getViewContainerEl().getBoundingClientRect()
+        var ratio = Math.round(rect.width / rect.height * 100)
         expect(Math.round(ratio)).toEqual(200)
       })
 
@@ -58,15 +57,14 @@ describe('aspectRatio', function() {
 
       it('should not change the width', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = getViewContainerEl().width()
-        expect(Math.round(width)).toEqual(elementWidth)
+        var rect = getViewContainerEl().getBoundingClientRect()
+        expect(Math.round(rect.width)).toEqual(elementWidth)
       })
 
       it('should set the height to width sizes very close to ratio of 2', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = getViewContainerEl().width()
-        var height = getViewContainerEl().height()
-        var ratio = Math.round(width / height * 100)
+        var rect = getViewContainerEl().getBoundingClientRect()
+        var ratio = Math.round(rect.width / rect.height * 100)
         expect(Math.round(ratio)).toEqual(100)
       })
 
@@ -80,15 +78,14 @@ describe('aspectRatio', function() {
 
       it('should not change the width', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = getViewContainerEl().width()
-        expect(Math.round(width)).toEqual(elementWidth)
+        var rect = getViewContainerEl().getBoundingClientRect()
+        expect(Math.round(rect.width)).toEqual(elementWidth)
       })
 
       it('should set the height to width ratio to 0.5', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = getViewContainerEl().width()
-        var height = getViewContainerEl().height()
-        var ratio = Math.round(width / height * 100)
+        var rect = getViewContainerEl().getBoundingClientRect()
+        var ratio = Math.round(rect.width / rect.height * 100)
         expect(Math.round(ratio)).toEqual(50)
       })
 
@@ -102,15 +99,14 @@ describe('aspectRatio', function() {
 
       it('should not change the width', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = getViewContainerEl().width()
-        expect(Math.round(width)).toEqual(elementWidth)
+        var rect = getViewContainerEl().getBoundingClientRect()
+        expect(Math.round(rect.width)).toEqual(elementWidth)
       })
 
       it('should set the height to width ratio to 0.5', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = getViewContainerEl().width()
-        var height = getViewContainerEl().height()
-        var ratio = Math.round(width / height * 100)
+        var rect = getViewContainerEl().getBoundingClientRect()
+        var ratio = Math.round(rect.width / rect.height * 100)
         expect(Math.round(ratio)).toEqual(50)
       })
 
@@ -124,15 +120,14 @@ describe('aspectRatio', function() {
 
       it('should not change the width', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = getViewContainerEl().width()
-        expect(Math.round(width)).toEqual(elementWidth)
+        var rect = getViewContainerEl().getBoundingClientRect()
+        expect(Math.round(rect.width)).toEqual(elementWidth)
       })
 
       it('should set the height to width ratio to 0.5', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = getViewContainerEl().width()
-        var height = getViewContainerEl().height()
-        var ratio = Math.round(width / height * 100)
+        var rect = getViewContainerEl().getBoundingClientRect()
+        var ratio = Math.round(rect.width / rect.height * 100)
         expect(Math.round(ratio)).toEqual(50)
       })
 
@@ -146,15 +141,15 @@ describe('aspectRatio', function() {
 
       it('should not change the width', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var width = getViewContainerEl().width()
-        expect(Math.round(width)).toEqual(elementWidth)
+        var rect = getViewContainerEl().getBoundingClientRect()
+        expect(Math.round(rect.width)).toEqual(elementWidth)
       })
 
       it('should cause rows to be natural height', function() {
         initCalendar({}, getCalendarElement(elementWidth))
-        var actualHeight = getViewContainerEl().height()
+        var actualHeight = getViewContainerEl().getBoundingClientRect().height
         $('tr.fc-week td:first-child > div').css('min-height', '').css('background', 'red')
-        var naturalHeight = getViewContainerEl().height()
+        var naturalHeight = getViewContainerEl().getBoundingClientRect().height
         expect(Math.round(actualHeight)).toEqual(Math.round(naturalHeight))
       })
 

+ 6 - 6
packages/__tests__/src/legacy/background-events.js

@@ -497,7 +497,7 @@ describe('background events', function() {
         } ]
         options._eventsPositioned = function() {
           expect(getBackgroundEventEls().length).toBe(1)
-          expect(queryBgEventsInCol(4).length).toBe(1)
+          expect(queryBgEventsInCol(2).length).toBe(1)
           expect(getBackgroundEventEls()).toBeBelow('.fc-slats tr:eq(0)') // should be 1am (eq(1)) but FF cmplaining
           expect(getBackgroundEventEls()).toBeAbove('.fc-slats tr:eq(10)') // 5am
           done()
@@ -514,7 +514,7 @@ describe('background events', function() {
         options._eventsPositioned = function() {
           expect(getBackgroundEventEls().length).toBe(2)
           expect(queryBgEventsInCol(3).length).toBe(1)
-          expect(queryBgEventsInCol(4).length).toBe(1)
+          expect(queryBgEventsInCol(2).length).toBe(1)
           done()
         }
         initCalendar(options)
@@ -535,11 +535,11 @@ describe('background events', function() {
           // time area
           expect(getTimeGridNonBusinessDayEls().length).toBe(11)
           expect(queryNonBusinessSegsInCol(0).length).toBe(1)
-          expect(queryNonBusinessSegsInCol(1).length).toBe(1)
+          expect(queryNonBusinessSegsInCol(1).length).toBe(2)
           expect(queryNonBusinessSegsInCol(2).length).toBe(2)
           expect(queryNonBusinessSegsInCol(3).length).toBe(2)
           expect(queryNonBusinessSegsInCol(4).length).toBe(2)
-          expect(queryNonBusinessSegsInCol(5).length).toBe(2)
+          expect(queryNonBusinessSegsInCol(5).length).toBe(1)
           expect(queryNonBusinessSegsInCol(6).length).toBe(1)
         })
       })
@@ -713,9 +713,9 @@ describe('background events', function() {
             expect(getBackgroundEventEls().length).toBe(8)
             expect(queryBgEventsInCol(0).length).toBe(1)
             expect(queryBgEventsInCol(1).length).toBe(1)
-            expect(queryBgEventsInCol(2).length).toBe(1)
+            expect(queryBgEventsInCol(2).length).toBe(2)
             expect(queryBgEventsInCol(3).length).toBe(1)
-            expect(queryBgEventsInCol(4).length).toBe(2)
+            expect(queryBgEventsInCol(4).length).toBe(1)
             expect(queryBgEventsInCol(5).length).toBe(1)
             expect(queryBgEventsInCol(6).length).toBe(1)
             // TODO: maybe check y coords

+ 9 - 9
packages/__tests__/src/legacy/columnHeaderFormat.js

@@ -9,9 +9,9 @@ describe('columnHeaderFormat', function() {
     var viewWithFormat = [
       { view: 'dayGridMonth', expected: /^Sun$/, selector: 'th.fc-day-header.fc-sun' },
       { view: 'dayGridWeek', expected: /^Sun 5[/ ]11$/, selector: 'th.fc-day-header.fc-sun' },
-      { view: 'timeGridWeek', expected: /^Sun 5[/ ]11$/, selector: 'th.fc-widget-header.fc-sun' },
+      { view: 'timeGridWeek', expected: /^Sun 5[/ ]11$/, selector: 'th.fc-day-header.fc-sun' },
       { view: 'dayGridDay', expected: /^Sunday$/, selector: 'th.fc-day-header.fc-sun' },
-      { view: 'timeGridDay', expected: /^Sunday$/, selector: 'th.fc-widget-header.fc-sun' }
+      { view: 'timeGridDay', expected: /^Sunday$/, selector: 'th.fc-day-header.fc-sun' }
     ]
 
     beforeEach(function() {
@@ -34,7 +34,7 @@ describe('columnHeaderFormat', function() {
 
     var viewWithFormat = [
       { view: 'dayGridMonth', expected: /^Sunday$/, selector: 'th.fc-day-header.fc-sun' },
-      { view: 'timeGridDay', expected: /^Sunday, May 11$/, selector: 'th.fc-widget-header.fc-sun' },
+      { view: 'timeGridDay', expected: /^Sunday, May 11$/, selector: 'th.fc-day-header.fc-sun' },
       { view: 'dayGridWeek', expected: /^Sunday, 5[/ ]11$/, selector: 'th.fc-day-header.fc-sun' }
     ]
 
@@ -64,9 +64,9 @@ describe('columnHeaderFormat', function() {
     var viewWithFormat = [
       { view: 'dayGridMonth', expected: /^dim\.$/, selector: 'th.fc-day-header.fc-sun' },
       { view: 'dayGridWeek', expected: /^dim\. 11[/ ]0?5$/, selector: 'th.fc-day-header.fc-sun' },
-      { view: 'timeGridWeek', expected: /^dim\. 11[/ ]0?5$/, selector: 'th.fc-widget-header.fc-sun' },
+      { view: 'timeGridWeek', expected: /^dim\. 11[/ ]0?5$/, selector: 'th.fc-day-header.fc-sun' },
       { view: 'dayGridDay', expected: /^dimanche$/, selector: 'th.fc-day-header.fc-sun' },
-      { view: 'timeGridDay', expected: /^dimanche$/, selector: 'th.fc-widget-header.fc-sun' }
+      { view: 'timeGridDay', expected: /^dimanche$/, selector: 'th.fc-day-header.fc-sun' }
     ]
 
     beforeEach(function() {
@@ -91,9 +91,9 @@ describe('columnHeaderFormat', function() {
     var viewWithFormat = [
       { view: 'dayGridMonth', expected: /^Sun$/, selector: 'th.fc-day-header.fc-sun' },
       { view: 'dayGridWeek', expected: /^Sun 11[/ ]0?5$/, selector: 'th.fc-day-header.fc-sun' },
-      { view: 'timeGridWeek', expected: /^Sun 11[/ ]0?5$/, selector: 'th.fc-widget-header.fc-sun' },
+      { view: 'timeGridWeek', expected: /^Sun 11[/ ]0?5$/, selector: 'th.fc-day-header.fc-sun' },
       { view: 'dayGridDay', expected: /^Sunday$/, selector: 'th.fc-day-header.fc-sun' },
-      { view: 'timeGridDay', expected: /^Sunday$/, selector: 'th.fc-widget-header.fc-sun' }
+      { view: 'timeGridDay', expected: /^Sunday$/, selector: 'th.fc-day-header.fc-sun' }
     ]
 
     beforeEach(function() {
@@ -118,9 +118,9 @@ describe('columnHeaderFormat', function() {
     var viewWithFormat = [
       { view: 'dayGridMonth', expected: /^일$/, selector: 'th.fc-day-header.fc-sun' },
       { view: 'dayGridWeek', expected: /^5[.월] 11[.일] \(?일\)?$/, selector: 'th.fc-day-header.fc-sun' },
-      { view: 'timeGridWeek', expected: /^5[.월] 11[.일] \(?일\)?$/, selector: 'th.fc-widget-header.fc-sun' },
+      { view: 'timeGridWeek', expected: /^5[.월] 11[.일] \(?일\)?$/, selector: 'th.fc-day-header.fc-sun' },
       { view: 'dayGridDay', expected: /^일요일$/, selector: 'th.fc-day-header.fc-sun' },
-      { view: 'timeGridDay', expected: /^일요일$/, selector: 'th.fc-widget-header.fc-sun' }
+      { view: 'timeGridDay', expected: /^일요일$/, selector: 'th.fc-day-header.fc-sun' }
     ]
 
     beforeEach(function() {

+ 3 - 19
packages/__tests__/src/legacy/dayRender.js

@@ -10,7 +10,7 @@ describe('dayRender', function() {
       dayRender: function(arg) {
         expect(arg.date instanceof Date).toEqual(true)
         expect(formatIsoDay(arg.date)).toEqual(arg.el.getAttribute('data-date'))
-        expect(arg.el).toBeInDOM()
+        expect(arg.el instanceof HTMLElement).toBe(true)
       }
     }
 
@@ -19,23 +19,7 @@ describe('dayRender', function() {
     expect(options.dayRender.calls.count()).toEqual(42)
   })
 
-  it('is called when view is changed', function() {
-    var options = {
-      defaultView: 'dayGridMonth',
-      fixedWeekCount: true,
-      defaultDate: '2014-05-01',
-      dayRender: function(arg) { }
-    }
-
-    spyOn(options, 'dayRender').and.callThrough()
-    initCalendar(options)
-    options.dayRender.calls.reset()
-    currentCalendar.changeView('dayGridWeek')
-    expect(options.dayRender.calls.count()).toEqual(7)
-  })
-
-  // called if the date is navigated to a different visible range
-  it('is called when view is changed', function() {
+  it('is called when date range is changed', function() {
     var options = {
       defaultView: 'dayGridWeek',
       defaultDate: '2014-05-01',
@@ -76,7 +60,7 @@ describe('dayRender', function() {
     }
 
     initCalendar(options)
-    expect($(currentCalendar.el).find('td[data-date="2014-05-01"]')).toHaveClass('mycustomclass')
+    expect($(currentCalendar.el).find('.fc-bg td[data-date="2014-05-01"]')).toHaveClass('mycustomclass')
   })
 
   it('gets called for TimeGrid views', function() {

+ 10 - 36
packages/__tests__/src/legacy/daygrid-view.js

@@ -5,42 +5,16 @@ describe('dayGrid view rendering', function() {
     defaultView: 'dayGridMonth'
   })
 
-  describe('when dir is ltr', function() {
-
-    pushOptions({
-      dir: 'ltr'
-    })
-
-    it('should have days ordered sun to sat', function() {
-      initCalendar()
-      var fc = $(currentCalendar.el).find('.fc-day-header')
-      expect(fc[0]).toHaveClass('fc-sun')
-      expect(fc[1]).toHaveClass('fc-mon')
-      expect(fc[2]).toHaveClass('fc-tue')
-      expect(fc[3]).toHaveClass('fc-wed')
-      expect(fc[4]).toHaveClass('fc-thu')
-      expect(fc[5]).toHaveClass('fc-fri')
-      expect(fc[6]).toHaveClass('fc-sat')
-    })
-  })
-
-  describe('when dir is rtl', function() {
-
-    pushOptions({
-      dir: 'rtl'
-    })
-
-    it('should have days ordered sat to sun', function() {
-      initCalendar()
-      var fc = $(currentCalendar.el).find('.fc-day-header')
-      expect(fc[0]).toHaveClass('fc-sat')
-      expect(fc[1]).toHaveClass('fc-fri')
-      expect(fc[2]).toHaveClass('fc-thu')
-      expect(fc[3]).toHaveClass('fc-wed')
-      expect(fc[4]).toHaveClass('fc-tue')
-      expect(fc[5]).toHaveClass('fc-mon')
-      expect(fc[6]).toHaveClass('fc-sun')
-    })
+  it('should have days ordered sun to sat', function() {
+    initCalendar()
+    var fc = $(currentCalendar.el).find('.fc-day-header')
+    expect(fc[0]).toHaveClass('fc-sun')
+    expect(fc[1]).toHaveClass('fc-mon')
+    expect(fc[2]).toHaveClass('fc-tue')
+    expect(fc[3]).toHaveClass('fc-wed')
+    expect(fc[4]).toHaveClass('fc-thu')
+    expect(fc[5]).toHaveClass('fc-fri')
+    expect(fc[6]).toHaveClass('fc-sat')
   })
 
 })

+ 1 - 1
packages/__tests__/src/legacy/event-dnd.js

@@ -270,7 +270,7 @@ describe('eventDrop', function() {
         init(
           function() {
             var allDayGrid = $('.fc-timeGrid-view .fc-day-grid')
-            var hr = allDayGrid.next('hr')
+            var hr = $('.fc-timeGrid-view .fc-divider')
             $('.fc-event').simulate('drag', {
               dx: $('th.fc-wed').width() * -1,
               dy: allDayGrid.outerHeight() + hr.outerHeight()

+ 2 - 2
packages/__tests__/src/legacy/eventLimit-popover.js

@@ -52,7 +52,7 @@ describe('eventLimit popover', function() {
       })
       openWithClick()
       setTimeout(function() {
-        var cell = $('.fc-day-grid .fc-row:eq(0) .fc-bg td:not(.fc-axis):eq(4)')
+        var cell = $('.fc-day-grid .fc-row:eq(0) .fc-bg td:not(.fc-axis):eq(2)')
         var cellRight = cell.offset().left + cell.outerWidth()
         var popover = $('.fc-more-popover')
         var popoverRight = popover.offset().left + popover.outerWidth()
@@ -292,7 +292,7 @@ describe('eventLimit popover', function() {
       openWithClick()
       setTimeout(function() {
         var popoverTop = $('.fc-more-popover').offset().top
-        var headTop = $('.fc-view > table > thead .fc-row').offset().top
+        var headTop = $('.fc-view .fc-head .fc-scroller').offset().top
         var diff = Math.abs(popoverTop - headTop)
         expect(diff).toBeLessThan(2)
         done()

+ 4 - 19
packages/__tests__/src/legacy/firstDay.js

@@ -61,7 +61,10 @@ describe('First Day', function() {
     })
   })
 
-  describe('when setting firstDay to 2', function() {
+  describeOptions('dir', {
+    'when LTR': 'ltr',
+    'when RTL': 'rtl'
+  }, function() {
     pushOptions({
       firstDay: 2
     })
@@ -179,24 +182,6 @@ describe('First Day', function() {
     })
   })
 
-  describe('when first day is set to Tuesday and dir is rtl', function() {
-    pushOptions({
-      firstDay: 2,
-      dir: 'rtl'
-    })
-    it('should put days mon, sun, sat ...', function() {
-      initCalendar()
-      var daysOfWeek = $('.fc-day-header')
-      expect(daysOfWeek[0]).toHaveClass('fc-mon')
-      expect(daysOfWeek[1]).toHaveClass('fc-sun')
-      expect(daysOfWeek[2]).toHaveClass('fc-sat')
-      expect(daysOfWeek[3]).toHaveClass('fc-fri')
-      expect(daysOfWeek[4]).toHaveClass('fc-thu')
-      expect(daysOfWeek[5]).toHaveClass('fc-wed')
-      expect(daysOfWeek[6]).toHaveClass('fc-tue')
-    })
-  })
-
   it('should have a different default value based on the locale', function() {
     initCalendar({
       locale: enGbLocale

+ 2 - 22
packages/__tests__/src/legacy/height-and-contentHeight.js

@@ -10,8 +10,7 @@ import { getFirstDateEl } from '../lib/ViewUtils'
 
       /** @type {any} */
       var heightPropDescriptions = [
-        { description: 'as a number', height: 600 },
-        { description: 'as a function', height: getParentHeight, heightWrapper: true }
+        { description: 'as a number', height: 600 }
       ]
 
       if (heightProp === 'height') {
@@ -30,10 +29,6 @@ import { getFirstDateEl } from '../lib/ViewUtils'
         calendarEl.remove()
       })
 
-      function getParentHeight() {
-        return calendarEl.parent().height()
-      }
-
       // relies on asAMethod (boolean)
       // otherOptions: other calendar options to dynamically set (assumes asAMethod)
       function init(heightVal) {
@@ -238,28 +233,15 @@ import { getFirstDateEl } from '../lib/ViewUtils'
                         })
                       }
 
-                      describe('with only a few slots', function() {
-                        pushOptions({
-                          minTime: '06:00:00',
-                          maxTime: '10:00:00'
-                        })
-                        it('should be the correct height, with a horizontal rule to occupy space', function() {
-                          init(testInfo.height)
-                          expectHeight(600)
-                          expect($('.fc-time-grid > hr')).toBeVisible()
-                        })
-                      })
-
                       describe('with many slots', function() {
                         pushOptions({
                           minTime: '00:00:00',
                           maxTime: '24:00:00'
                         })
-                        it('should be the correct height, with scrollbars and no filler hr', function() {
+                        it('should be the correct height, with scrollbars', function() {
                           init(testInfo.height)
                           expectHeight(600)
                           expect($('.scrollgrid .fc-body:last-child .fc-scroller')).toHaveScrollbars()
-                          expect($('.fc-time-grid > hr')).not.toBeVisible()
                         })
                       })
                     })
@@ -274,7 +256,6 @@ import { getFirstDateEl } from '../lib/ViewUtils'
                       init('auto')
                       expect(heightElm.outerHeight()).toBeLessThan(500) // pretty short
                       expect($('.scrollgrid .fc-body:last-child .fc-scroller')).not.toHaveScrollbars()
-                      expect($('.fc-time-grid > hr')).not.toBeVisible()
                     })
                   })
 
@@ -287,7 +268,6 @@ import { getFirstDateEl } from '../lib/ViewUtils'
                       init('auto')
                       expect(heightElm.outerHeight()).toBeGreaterThan(900) // pretty tall
                       expect($('.scrollgrid .fc-body:last-child .fc-scroller')).not.toHaveScrollbars()
-                      expect($('.fc-time-grid > hr')).not.toBeVisible()
                     })
                   })
                 })

+ 0 - 20
packages/__tests__/src/legacy/nowIndicator.js

@@ -1,7 +1,6 @@
 import { getBoundingRect } from '../lib/dom-geom'
 import { isElWithinRtl } from '../lib/dom-misc'
 import { getTimeGridLine } from '../lib/time-grid'
-import { TimeCols } from '@fullcalendar/timegrid'
 
 describe('now indicator', function() {
   var options
@@ -65,25 +64,6 @@ describe('now indicator', function() {
         })
       })
     })
-
-    // https://github.com/fullcalendar/fullcalendar/issues/3872
-    it('doesnt double render indicator arrow', function(done) {
-
-      // force the indicator to update every second
-      var getNowIndicatorUnit = spyOnMethod(TimeCols, 'getNowIndicatorUnit', true)
-        .and.returnValue('second')
-
-      options.defaultDate = '2016-01-01' // does NOT have "now" in view
-      options.nowIndicator = true
-      initCalendar(options)
-      currentCalendar.today() // the bug only happens after navigate
-
-      setTimeout(function() {
-        expect($('.fc-now-indicator-arrow').length).toBe(1)
-        getNowIndicatorUnit.restore()
-        done()
-      }, 2100) // allows for more than 1 update
-    })
   })
 
   function isNowIndicatorRendered() {

+ 13 - 38
packages/__tests__/src/legacy/timegrid-view.js

@@ -11,45 +11,20 @@ const [
 const AXIS_CLASS = 'fc-axis'
 
 describe('timeGrid view rendering', function() {
-
-  describe('when dir is ltr', function() {
-    pushOptions({
-      defaultView: 'timeGridWeek',
-      dir: 'ltr'
-    })
-
-    it('should have have days ordered sun to sat', function() {
-      initCalendar()
-      var headers = getHeaderTopEls()
-      expect(headers[0]).toHaveClass(AXIS_CLASS)
-      expect(headers[1]).toHaveClass(SUNDAY_CLASS)
-      expect(headers[2]).toHaveClass(MONDAY_CLASS)
-      expect(headers[3]).toHaveClass(TUESDAY_CLASS)
-      expect(headers[4]).toHaveClass(WEDNESDAY_CLASS)
-      expect(headers[5]).toHaveClass(THURSDAY_CLASS)
-      expect(headers[6]).toHaveClass(FRIDAY_CLASS)
-      expect(headers[7]).toHaveClass(SATURDY_CLASS)
-    })
+  pushOptions({
+    defaultView: 'timeGridWeek'
   })
 
-  describe('when dir is rtl', function() {
-    pushOptions({
-      defaultView: 'timeGridWeek',
-      dir: 'rtl'
-    })
-
-    it('should have have days ordered sat to sun', function() {
-      initCalendar()
-      var headers = getHeaderTopEls()
-      expect(headers[0]).toHaveClass(SATURDY_CLASS)
-      expect(headers[1]).toHaveClass(FRIDAY_CLASS)
-      expect(headers[2]).toHaveClass(THURSDAY_CLASS)
-      expect(headers[3]).toHaveClass(WEDNESDAY_CLASS)
-      expect(headers[4]).toHaveClass(TUESDAY_CLASS)
-      expect(headers[5]).toHaveClass(MONDAY_CLASS)
-      expect(headers[6]).toHaveClass(SUNDAY_CLASS)
-      expect(headers[7]).toHaveClass(AXIS_CLASS)
-    })
+  it('should have have days ordered sun to sat', function() {
+    initCalendar()
+    var headers = getHeaderTopEls()
+    expect(headers[0]).toHaveClass(AXIS_CLASS)
+    expect(headers[1]).toHaveClass(SUNDAY_CLASS)
+    expect(headers[2]).toHaveClass(MONDAY_CLASS)
+    expect(headers[3]).toHaveClass(TUESDAY_CLASS)
+    expect(headers[4]).toHaveClass(WEDNESDAY_CLASS)
+    expect(headers[5]).toHaveClass(THURSDAY_CLASS)
+    expect(headers[6]).toHaveClass(FRIDAY_CLASS)
+    expect(headers[7]).toHaveClass(SATURDY_CLASS)
   })
-
 })

+ 1 - 1
packages/__tests__/src/legacy/weekNumbers.js

@@ -384,7 +384,7 @@ describe('weekNumbers', function() {
     t.allWeekNumbers = $('.fc-week-number').length
     t.colWeekNumbers = $('.fc-content-skeleton thead td.fc-week-number').length
     t.cellWeekNumbers = $('.fc-content-skeleton thead .fc-day-top span.fc-week-number').length
-    t.cornerWeekNumbers = $('.fc-axis.fc-widget-header.fc-week-number').length
+    t.cornerWeekNumbers = $('.fc-head .fc-axis.fc-week-number').length
 
     return t
   }

+ 4 - 0
packages/__tests__/src/lib/ListViewUtils.js

@@ -58,3 +58,7 @@ export function getEmptyMessageEls() {
 export function getEmptyMessageElsCount() {
   return getEmptyMessageEls().length
 }
+
+export function getListViewScrollerEl() {
+  return $('.fc-list-view .fc-scroller')
+}

+ 1 - 1
packages/__tests__/src/lib/MonthViewUtils.js

@@ -1,6 +1,6 @@
 const SCROLLER_CLASS = 'fc-scroller'
 
 export function getScrollerEl() {
-  return $(currentCalendar.el).find(`.${SCROLLER_CLASS}`)
+  return $(currentCalendar.el).find(`.fc-body .${SCROLLER_CLASS}`)
 }
 

+ 2 - 2
packages/__tests__/src/lib/ViewUtils.js

@@ -1,8 +1,8 @@
 const VIEW_CONTAINER_CLASS = 'fc-view-container'
 
 
-export function getViewContainerEl() {
-  return $(`.${VIEW_CONTAINER_CLASS}`)
+export function getViewContainerEl() { // returns a DOM element
+  return document.querySelector(`.${VIEW_CONTAINER_CLASS}`)
 }
 
 

+ 0 - 1
packages/__tests__/src/theme/switching.js

@@ -23,7 +23,6 @@ describe('theme switching', function() {
 
   function verifyStandardTheme() {
     expect($('.fc-unthemed')).toBeInDOM()
-    expect($('.fc-widget-header')).toBeInDOM()
   }
 
   function verifyBootstrapTheme() {

+ 1 - 1
packages/__tests__/src/view-render/daygrid-dirty-hit.js

@@ -19,7 +19,7 @@ describe('daygrid view with updated dimensions', function() {
     }, $wrapper.children().get(0))
 
     $wrapper.width(400)
-    // currentCalendar.updateSize()
+    currentCalendar.updateSize()
 
     getDayEl('2019-04-02').simulate('drag') // a click
   })