|
|
@@ -18,38 +18,48 @@ describe('eventLimit popover', function() {
|
|
|
handleWindowResize: false // because showing the popover causes scrollbars and fires resize
|
|
|
})
|
|
|
|
|
|
- function init() {
|
|
|
+ function openWithClick() {
|
|
|
$('.fc-more').simulate('click')
|
|
|
}
|
|
|
|
|
|
+ function closeWithClick() {
|
|
|
+ $('.fc-more-popover .fc-close').simulate('click')
|
|
|
+ }
|
|
|
+
|
|
|
describeOptions('defaultView', {
|
|
|
'when in month view': 'dayGridMonth',
|
|
|
'when in dayGridWeek view': 'dayGridWeek',
|
|
|
'when in week view': 'timeGridWeek'
|
|
|
}, function() {
|
|
|
|
|
|
- it('aligns horizontally with left edge of cell if LTR', function() {
|
|
|
+ it('aligns horizontally with left edge of cell if LTR', function(done) {
|
|
|
initCalendar({
|
|
|
dir: 'ltr'
|
|
|
})
|
|
|
- init()
|
|
|
- var cellLeft = $('.fc-day-grid .fc-row:eq(0) .fc-bg td:not(.fc-axis):eq(2)').offset().left
|
|
|
- var popoverLeft = $('.fc-more-popover').offset().left
|
|
|
- var diff = Math.abs(cellLeft - popoverLeft)
|
|
|
- expect(diff).toBeLessThan(2)
|
|
|
+ openWithClick()
|
|
|
+ setTimeout(function() {
|
|
|
+ var cellLeft = $('.fc-day-grid .fc-row:eq(0) .fc-bg td:not(.fc-axis):eq(2)').offset().left
|
|
|
+ var popoverLeft = $('.fc-more-popover').offset().left
|
|
|
+ var diff = Math.abs(cellLeft - popoverLeft)
|
|
|
+ expect(diff).toBeLessThan(2)
|
|
|
+ done()
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
- it('aligns horizontally with left edge of cell if RTL', function() {
|
|
|
+ it('aligns horizontally with left edge of cell if RTL', function(done) {
|
|
|
initCalendar({
|
|
|
dir: 'rtl'
|
|
|
})
|
|
|
- init()
|
|
|
- var cell = $('.fc-day-grid .fc-row:eq(0) .fc-bg td:not(.fc-axis):eq(4)')
|
|
|
- var cellRight = cell.offset().left + cell.outerWidth()
|
|
|
- var popover = $('.fc-more-popover')
|
|
|
- var popoverRight = popover.offset().left + popover.outerWidth()
|
|
|
- var diff = Math.abs(cellRight - popoverRight)
|
|
|
- expect(diff).toBeLessThan(2)
|
|
|
+ openWithClick()
|
|
|
+ setTimeout(function() {
|
|
|
+ var cell = $('.fc-day-grid .fc-row:eq(0) .fc-bg td:not(.fc-axis):eq(4)')
|
|
|
+ var cellRight = cell.offset().left + cell.outerWidth()
|
|
|
+ var popover = $('.fc-more-popover')
|
|
|
+ var popoverRight = popover.offset().left + popover.outerWidth()
|
|
|
+ var diff = Math.abs(cellRight - popoverRight)
|
|
|
+ expect(diff).toBeLessThan(2)
|
|
|
+ done()
|
|
|
+ })
|
|
|
})
|
|
|
})
|
|
|
|
|
|
@@ -59,16 +69,19 @@ describe('eventLimit popover', function() {
|
|
|
defaultView: 'dayGridMonth'
|
|
|
})
|
|
|
|
|
|
- it('aligns with top of cell', function() {
|
|
|
+ it('aligns with top of cell', function(done) {
|
|
|
initCalendar()
|
|
|
- init()
|
|
|
- var popoverTop = $('.fc-more-popover').offset().top
|
|
|
- var rowTop = $('.fc-day-grid .fc-row:eq(0)').offset().top
|
|
|
- var diff = Math.abs(popoverTop - rowTop)
|
|
|
- expect(diff).toBeLessThan(2)
|
|
|
+ openWithClick()
|
|
|
+ setTimeout(function() {
|
|
|
+ var popoverTop = $('.fc-more-popover').offset().top
|
|
|
+ var rowTop = $('.fc-day-grid .fc-row:eq(0)').offset().top
|
|
|
+ var diff = Math.abs(popoverTop - rowTop)
|
|
|
+ expect(diff).toBeLessThan(2)
|
|
|
+ done()
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
- it('works with background events', function() {
|
|
|
+ it('works with background events', function(done) {
|
|
|
testEvents.push({
|
|
|
start: '2014-07-29',
|
|
|
rendering: 'background'
|
|
|
@@ -76,12 +89,15 @@ describe('eventLimit popover', function() {
|
|
|
initCalendar({
|
|
|
events: testEvents
|
|
|
})
|
|
|
- init()
|
|
|
- expect($('.fc-more-popover .fc-event').length).toBeGreaterThan(1)
|
|
|
- expect($('.fc-more-popover .fc-bgevent').length).toBe(0)
|
|
|
+ openWithClick()
|
|
|
+ setTimeout(function() {
|
|
|
+ expect($('.fc-more-popover .fc-event').length).toBeGreaterThan(1)
|
|
|
+ expect($('.fc-more-popover .fc-bgevent').length).toBe(0)
|
|
|
+ done()
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
- it('works with events that have invalid end times', function() {
|
|
|
+ it('works with events that have invalid end times', function(done) {
|
|
|
initCalendar({
|
|
|
events: [
|
|
|
{ title: 'event1', start: '2014-07-29', end: '2014-07-29' },
|
|
|
@@ -90,12 +106,15 @@ describe('eventLimit popover', function() {
|
|
|
{ title: 'event4', start: '2014-07-29T00:00:00', end: '2014-07-28T23:00:00' }
|
|
|
]
|
|
|
})
|
|
|
- init()
|
|
|
- expect($('.fc-more-popover .fc-event').length).toBe(4)
|
|
|
+ openWithClick()
|
|
|
+ setTimeout(function() {
|
|
|
+ expect($('.fc-more-popover .fc-event').length).toBe(4)
|
|
|
+ done()
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
// issue 2385
|
|
|
- it('orders events correctly regardless of ID', function() {
|
|
|
+ it('orders events correctly regardless of ID', function(done) {
|
|
|
initCalendar({
|
|
|
defaultDate: '2012-03-22',
|
|
|
eventLimit: 3,
|
|
|
@@ -151,19 +170,24 @@ describe('eventLimit popover', function() {
|
|
|
}
|
|
|
]
|
|
|
})
|
|
|
- init()
|
|
|
|
|
|
- var titles = $('.fc-more-popover .fc-event .fc-title').map(function() {
|
|
|
- return $(this).text()
|
|
|
- }).get()
|
|
|
+ openWithClick()
|
|
|
+ setTimeout(function() {
|
|
|
+
|
|
|
+ var titles = $('.fc-more-popover .fc-event .fc-title').map(function() {
|
|
|
+ return $(this).text()
|
|
|
+ }).get()
|
|
|
|
|
|
- expect(titles).toEqual([
|
|
|
- 'event01', 'event05', 'event07', 'event03', 'event02', 'event08', 'event04'
|
|
|
- ])
|
|
|
+ expect(titles).toEqual([
|
|
|
+ 'event01', 'event05', 'event07', 'event03', 'event02', 'event08', 'event04'
|
|
|
+ ])
|
|
|
+
|
|
|
+ done()
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
// https://github.com/fullcalendar/fullcalendar/issues/3856
|
|
|
- it('displays multi-day events only once', function() {
|
|
|
+ it('displays multi-day events only once', function(done) {
|
|
|
initCalendar({
|
|
|
defaultDate: '2017-10-04',
|
|
|
events: [
|
|
|
@@ -191,32 +215,37 @@ describe('eventLimit popover', function() {
|
|
|
}
|
|
|
]
|
|
|
})
|
|
|
- init()
|
|
|
-
|
|
|
- expect($('.fc-popover .fc-event').length).toBe(4)
|
|
|
-
|
|
|
- var longEventEl = $('.fc-popover .long-event')
|
|
|
- expect(longEventEl.length).toBe(1)
|
|
|
- expect(longEventEl).toHaveClass('fc-not-start')
|
|
|
- expect(longEventEl).toHaveClass('fc-not-end')
|
|
|
- expect(longEventEl).not.toHaveClass('fc-start')
|
|
|
- expect(longEventEl).not.toHaveClass('fc-end');
|
|
|
-
|
|
|
- [
|
|
|
- $('.fc-popover .meeting-event'),
|
|
|
- $('.fc-popover .lunch1-event'),
|
|
|
- $('.fc-popover .lunch2-event')
|
|
|
- ].forEach(function(el) {
|
|
|
- expect(el.length).toBe(1)
|
|
|
- expect(el).toHaveClass('fc-start')
|
|
|
- expect(el).toHaveClass('fc-end')
|
|
|
- expect(el).not.toHaveClass('fc-not-start')
|
|
|
- expect(el).not.toHaveClass('fc-not-end')
|
|
|
+
|
|
|
+ openWithClick()
|
|
|
+ setTimeout(function() {
|
|
|
+
|
|
|
+ expect($('.fc-popover .fc-event').length).toBe(4)
|
|
|
+
|
|
|
+ var longEventEl = $('.fc-popover .long-event')
|
|
|
+ expect(longEventEl.length).toBe(1)
|
|
|
+ expect(longEventEl).toHaveClass('fc-not-start')
|
|
|
+ expect(longEventEl).toHaveClass('fc-not-end')
|
|
|
+ expect(longEventEl).not.toHaveClass('fc-start')
|
|
|
+ expect(longEventEl).not.toHaveClass('fc-end');
|
|
|
+
|
|
|
+ [
|
|
|
+ $('.fc-popover .meeting-event'),
|
|
|
+ $('.fc-popover .lunch1-event'),
|
|
|
+ $('.fc-popover .lunch2-event')
|
|
|
+ ].forEach(function(el) {
|
|
|
+ expect(el.length).toBe(1)
|
|
|
+ expect(el).toHaveClass('fc-start')
|
|
|
+ expect(el).toHaveClass('fc-end')
|
|
|
+ expect(el).not.toHaveClass('fc-not-start')
|
|
|
+ expect(el).not.toHaveClass('fc-not-end')
|
|
|
+ })
|
|
|
+
|
|
|
+ done()
|
|
|
})
|
|
|
})
|
|
|
|
|
|
// https://github.com/fullcalendar/fullcalendar/issues/4331
|
|
|
- it('displays events that were collapsed in previous days', function() {
|
|
|
+ it('displays events that were collapsed in previous days', function(done) {
|
|
|
initCalendar({
|
|
|
defaultDate: '2018-10-01',
|
|
|
events: [
|
|
|
@@ -248,6 +277,8 @@ describe('eventLimit popover', function() {
|
|
|
// click the second +more link
|
|
|
$('.event-e5').closest('.fc-event-container').find('.fc-more')
|
|
|
.simulate('click')
|
|
|
+
|
|
|
+ setTimeout(done)
|
|
|
})
|
|
|
|
|
|
})
|
|
|
@@ -256,24 +287,34 @@ describe('eventLimit popover', function() {
|
|
|
'when in dayGridWeek view': 'dayGridWeek',
|
|
|
'when in week view': 'timeGridWeek'
|
|
|
}, function() {
|
|
|
- it('aligns with top of header', function() {
|
|
|
+ xit('aligns with top of header', function(done) {
|
|
|
initCalendar()
|
|
|
- init()
|
|
|
- var popoverTop = $('.fc-more-popover').offset().top
|
|
|
- var headTop = $('.fc-view > table > thead .fc-row').offset().top
|
|
|
- var diff = Math.abs(popoverTop - headTop)
|
|
|
- expect(diff).toBeLessThan(2)
|
|
|
+ openWithClick()
|
|
|
+ setTimeout(function() {
|
|
|
+ var popoverTop = $('.fc-more-popover').offset().top
|
|
|
+ var headTop = $('.fc-view > table > thead .fc-row').offset().top
|
|
|
+ var diff = Math.abs(popoverTop - headTop)
|
|
|
+ expect(diff).toBeLessThan(2)
|
|
|
+ done()
|
|
|
+ })
|
|
|
})
|
|
|
})
|
|
|
|
|
|
// TODO: somehow test how the popover does to the edge of any scroll container
|
|
|
|
|
|
- it('closes when user clicks the X', function() {
|
|
|
+ it('closes when user clicks the X', function(done) {
|
|
|
initCalendar()
|
|
|
- init()
|
|
|
- expect($('.fc-more-popover')).toBeVisible()
|
|
|
- $('.fc-more-popover .fc-close').simulate('click')
|
|
|
- expect($('.fc-more-popover')).not.toBeVisible()
|
|
|
+
|
|
|
+ openWithClick()
|
|
|
+ setTimeout(function() {
|
|
|
+ expect($('.fc-more-popover')).toBeVisible()
|
|
|
+
|
|
|
+ closeWithClick()
|
|
|
+ setTimeout(function() {
|
|
|
+ expect($('.fc-more-popover')).not.toBeVisible()
|
|
|
+ done()
|
|
|
+ })
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
// https://github.com/fullcalendar/fullcalendar/issues/4584
|
|
|
@@ -285,42 +326,63 @@ describe('eventLimit popover', function() {
|
|
|
})
|
|
|
|
|
|
initCalendar()
|
|
|
- init()
|
|
|
+ openWithClick()
|
|
|
+ setTimeout(function() {
|
|
|
+
|
|
|
+ let $headerEl = $('.fc-popover .fc-header')
|
|
|
+ expect($headerEl).toBeVisible()
|
|
|
|
|
|
- let $headerEl = $('.fc-popover .fc-header')
|
|
|
- expect($headerEl).toBeVisible()
|
|
|
+ $.simulateMouseClick($headerEl) // better for actual coordinates i think
|
|
|
+ setTimeout(function() { // because click would take some time to register
|
|
|
+ expect(dateClickCalled).toBe(false)
|
|
|
+ done()
|
|
|
+ }, 500)
|
|
|
|
|
|
- $.simulateMouseClick($headerEl) // better for actual coordinates i think
|
|
|
- setTimeout(function() { // because click would take some time to register
|
|
|
- expect(dateClickCalled).toBe(false)
|
|
|
done()
|
|
|
- }, 500)
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
- it('doesn\'t close when user clicks somewhere inside of the popover', function() {
|
|
|
+ it('doesn\'t close when user clicks somewhere inside of the popover', function(done) {
|
|
|
initCalendar()
|
|
|
- init()
|
|
|
- expect($('.fc-more-popover')).toBeVisible()
|
|
|
- expect($('.fc-more-popover .fc-header')).toBeInDOM()
|
|
|
- $('.fc-more-popover .fc-header').simulate('mousedown').simulate('click')
|
|
|
- expect($('.fc-more-popover')).toBeVisible()
|
|
|
+
|
|
|
+ openWithClick()
|
|
|
+ setTimeout(function() {
|
|
|
+ expect($('.fc-more-popover')).toBeVisible()
|
|
|
+ expect($('.fc-more-popover .fc-header')).toBeInDOM()
|
|
|
+
|
|
|
+ $('.fc-more-popover .fc-header').simulate('mousedown').simulate('click')
|
|
|
+ setTimeout(function() {
|
|
|
+ expect($('.fc-more-popover')).toBeVisible()
|
|
|
+ done()
|
|
|
+ })
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
- it('closes when user clicks outside of the popover', function() {
|
|
|
+ it('closes when user clicks outside of the popover', function(done) {
|
|
|
initCalendar()
|
|
|
- init()
|
|
|
- expect($('.fc-more-popover')).toBeVisible()
|
|
|
- $('body').simulate('mousedown').simulate('click')
|
|
|
- expect($('.fc-more-popover')).not.toBeVisible()
|
|
|
+
|
|
|
+ openWithClick()
|
|
|
+ setTimeout(function() {
|
|
|
+ expect($('.fc-more-popover')).toBeVisible()
|
|
|
+
|
|
|
+ $('body').simulate('mousedown').simulate('click')
|
|
|
+ setTimeout(function() {
|
|
|
+ expect($('.fc-more-popover')).not.toBeVisible()
|
|
|
+ done()
|
|
|
+ })
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
- it('has the correct event contents', function() {
|
|
|
+ it('has the correct event contents', function(done) {
|
|
|
initCalendar()
|
|
|
- init()
|
|
|
- expect($('.fc-more-popover .event1')).toBeMatchedBy('.fc-not-start.fc-end')
|
|
|
- expect($('.fc-more-popover .event2')).toBeMatchedBy('.fc-start.fc-not-end')
|
|
|
- expect($('.fc-more-popover .event3')).toBeMatchedBy('.fc-start.fc-end')
|
|
|
- expect($('.fc-more-popover .event4')).toBeMatchedBy('.fc-start.fc-end')
|
|
|
+ openWithClick()
|
|
|
+ setTimeout(function() {
|
|
|
+ expect($('.fc-more-popover .event1')).toBeMatchedBy('.fc-not-start.fc-end')
|
|
|
+ expect($('.fc-more-popover .event2')).toBeMatchedBy('.fc-start.fc-not-end')
|
|
|
+ expect($('.fc-more-popover .event3')).toBeMatchedBy('.fc-start.fc-end')
|
|
|
+ expect($('.fc-more-popover .event4')).toBeMatchedBy('.fc-start.fc-end')
|
|
|
+ done()
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
pushOptions({
|
|
|
@@ -341,8 +403,7 @@ describe('eventLimit popover', function() {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- init()
|
|
|
-
|
|
|
+ openWithClick()
|
|
|
setTimeout(function() { // simulate was getting confused about which thing was being clicked :(
|
|
|
$('.fc-more-popover .event4').simulate('drag', {
|
|
|
end: $('.fc-day-grid .fc-row:eq(0) .fc-bg td:not(.fc-axis):eq(1)') // one day before
|
|
|
@@ -370,8 +431,7 @@ describe('eventLimit popover', function() {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- init()
|
|
|
-
|
|
|
+ openWithClick()
|
|
|
setTimeout(function() { // simulate was getting confused about which thing was being clicked :(
|
|
|
$('.fc-more-popover .event5').simulate('drag', {
|
|
|
end: $('.fc-day-grid .fc-row:eq(0) .fc-bg td:not(.fc-axis):eq(1)') // one day before
|
|
|
@@ -394,8 +454,7 @@ describe('eventLimit popover', function() {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- init()
|
|
|
-
|
|
|
+ openWithClick()
|
|
|
setTimeout(function() { // simulate was getting confused about which thing was being clicked :(
|
|
|
$('.fc-more-popover .event4').simulate('drag', {
|
|
|
localPoint: {
|
|
|
@@ -421,8 +480,7 @@ describe('eventLimit popover', function() {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- init()
|
|
|
-
|
|
|
+ openWithClick()
|
|
|
setTimeout(function() { // simulate was getting confused about which thing was being clicked :(
|
|
|
$('.fc-more-popover .event1 .fc-title').simulate('drag', {
|
|
|
dx: 20
|
|
|
@@ -433,7 +491,7 @@ describe('eventLimit popover', function() {
|
|
|
|
|
|
})
|
|
|
|
|
|
- it('calls event render handlers', function() {
|
|
|
+ it('calls event render handlers', function(done) {
|
|
|
var options = {
|
|
|
events: [
|
|
|
{ title: 'event1', start: '2014-07-28', end: '2014-07-30', className: 'event1' },
|
|
|
@@ -459,19 +517,25 @@ describe('eventLimit popover', function() {
|
|
|
expect(options._eventsPositioned.calls.count()).toBe(1)
|
|
|
expect(options.eventDestroy.calls.count()).toBe(0)
|
|
|
|
|
|
- $('.fc-more').simulate('click')
|
|
|
+ openWithClick()
|
|
|
+ setTimeout(function() {
|
|
|
|
|
|
- expect(options.eventRender.calls.count()).toBe(8) // +4
|
|
|
- expect(options.eventPositioned.calls.count()).toBe(8) // +4
|
|
|
- expect(options._eventsPositioned.calls.count()).toBe(2) // +1
|
|
|
- expect(options.eventDestroy.calls.count()).toBe(0)
|
|
|
+ expect(options.eventRender.calls.count()).toBe(8) // +4
|
|
|
+ expect(options.eventPositioned.calls.count()).toBe(8) // +4
|
|
|
+ expect(options._eventsPositioned.calls.count()).toBe(2) // +1
|
|
|
+ expect(options.eventDestroy.calls.count()).toBe(0)
|
|
|
|
|
|
- $('.fc-more-popover .fc-close').simulate('click')
|
|
|
+ closeWithClick()
|
|
|
+ setTimeout(function() {
|
|
|
+
|
|
|
+ expect(options.eventRender.calls.count()).toBe(8)
|
|
|
+ expect(options.eventPositioned.calls.count()).toBe(8)
|
|
|
+ expect(options._eventsPositioned.calls.count()).toBe(2)
|
|
|
+ expect(options.eventDestroy.calls.count()).toBe(4) // +4
|
|
|
|
|
|
- expect(options.eventRender.calls.count()).toBe(8)
|
|
|
- expect(options.eventPositioned.calls.count()).toBe(8)
|
|
|
- expect(options._eventsPositioned.calls.count()).toBe(2)
|
|
|
- expect(options.eventDestroy.calls.count()).toBe(4) // +4
|
|
|
+ done()
|
|
|
+ })
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
})
|