Parcourir la source

when list views destroyed, wouldnt call eventDestroy. closes #4727

Adam Shaw il y a 6 ans
Parent
commit
69e7f49972
3 fichiers modifiés avec 20 ajouts et 7 suppressions
  1. 1 0
      CHANGELOG.md
  2. 18 6
      packages/__tests__/src/legacy/ListView.js
  3. 1 1
      packages/list/src/ListView.ts

+ 1 - 0
CHANGELOG.md

@@ -2,6 +2,7 @@
 next
 ----
 
+- when list views destroyed, wouldn't call eventDestroy (#4727)
 - solve JS errors when switching views and using showNonCurrentDates (#4677, #4767)
 - prevent unnecessary scrollbars from appearing in daygrid views (4624, #4732)
 - draggedEvent start time is null in eventAllow when switching resources (#4932)

+ 18 - 6
packages/__tests__/src/legacy/ListView.js

@@ -52,15 +52,27 @@ describe('ListView rendering', function() {
       })
 
       it('filters events through eventRender', function() {
-        var options = {}
-        options.eventRender = function(arg) {
-          replaceEventElDotElWithEl($(arg.el), '<span class="custom-icon" />')
-        }
-
-        initCalendar(options)
+        initCalendar({
+          eventRender(arg) {
+            replaceEventElDotElWithEl($(arg.el), '<span class="custom-icon" />')
+          }
+        })
 
         expect($('.custom-icon').length).toBe(2)
       })
+
+      it('filters events through eventDestroy', function() {
+        let callCnt = 0
+
+        initCalendar({
+          eventDestroy() {
+            callCnt++
+          }
+        })
+
+        currentCalendar.destroy()
+        expect(callCnt).toBe(2)
+      })
     })
 
     describe('when multi-day', function() {

+ 1 - 1
packages/list/src/ListView.ts

@@ -89,8 +89,8 @@ export default class ListView extends View {
   destroy() {
     super.destroy()
 
+    this.renderContent.unrender()
     this.scroller.destroy() // will remove the Grid too
-
     this.calendar.unregisterInteractiveComponent(this)
   }