mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 05:48:23 +08:00
FIX: prevents appEvents to leak (#7714)
This commit is contained in:
@ -154,6 +154,18 @@ QUnit.testDone(function() {
|
||||
flushMap();
|
||||
|
||||
server.shutdown();
|
||||
|
||||
// ensures any event not removed is not leaking between tests
|
||||
// most like in intialisers, other places (controller, component...)
|
||||
// should be fixed in code
|
||||
var appEvents = window.Discourse.__container__.lookup("app-events:main");
|
||||
var events = appEvents.__proto__._events;
|
||||
Object.keys(events).forEach(function(eventKey) {
|
||||
var event = events[eventKey];
|
||||
event.forEach(function(listener) {
|
||||
appEvents.off(eventKey, listener.target, listener.fn);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Load ES6 tests
|
||||
|
Reference in New Issue
Block a user