mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: reset widget clean callback between tests (#7761)
This commit is contained in:
@@ -4,12 +4,16 @@ import { queryRegistry } from "discourse/widgets/widget";
|
|||||||
import { getRegister } from "discourse-common/lib/get-owner";
|
import { getRegister } from "discourse-common/lib/get-owner";
|
||||||
import DirtyKeys from "discourse/lib/dirty-keys";
|
import DirtyKeys from "discourse/lib/dirty-keys";
|
||||||
|
|
||||||
const _cleanCallbacks = {};
|
let _cleanCallbacks = {};
|
||||||
export function addWidgetCleanCallback(widgetName, fn) {
|
export function addWidgetCleanCallback(widgetName, fn) {
|
||||||
_cleanCallbacks[widgetName] = _cleanCallbacks[widgetName] || [];
|
_cleanCallbacks[widgetName] = _cleanCallbacks[widgetName] || [];
|
||||||
_cleanCallbacks[widgetName].push(fn);
|
_cleanCallbacks[widgetName].push(fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function resetWidgetCleanCallbacks() {
|
||||||
|
_cleanCallbacks = {};
|
||||||
|
}
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
_tree: null,
|
_tree: null,
|
||||||
_rootNode: null,
|
_rootNode: null,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { flushMap } from "discourse/models/store";
|
|||||||
import { clearRewrites } from "discourse/lib/url";
|
import { clearRewrites } from "discourse/lib/url";
|
||||||
import { initSearchData } from "discourse/widgets/search-menu";
|
import { initSearchData } from "discourse/widgets/search-menu";
|
||||||
import { resetDecorators } from "discourse/widgets/widget";
|
import { resetDecorators } from "discourse/widgets/widget";
|
||||||
|
import { resetWidgetCleanCallbacks } from "discourse/components/mount-widget";
|
||||||
import { resetDecorators as resetPostCookedDecorators } from "discourse/widgets/post-cooked";
|
import { resetDecorators as resetPostCookedDecorators } from "discourse/widgets/post-cooked";
|
||||||
import { resetCache as resetOneboxCache } from "pretty-text/oneboxer";
|
import { resetCache as resetOneboxCache } from "pretty-text/oneboxer";
|
||||||
import { resetCustomPostMessageCallbacks } from "discourse/controllers/topic";
|
import { resetCustomPostMessageCallbacks } from "discourse/controllers/topic";
|
||||||
@@ -126,6 +127,7 @@ export function acceptance(name, options) {
|
|||||||
initSearchData();
|
initSearchData();
|
||||||
resetDecorators();
|
resetDecorators();
|
||||||
resetPostCookedDecorators();
|
resetPostCookedDecorators();
|
||||||
|
resetWidgetCleanCallbacks();
|
||||||
resetOneboxCache();
|
resetOneboxCache();
|
||||||
resetCustomPostMessageCallbacks();
|
resetCustomPostMessageCallbacks();
|
||||||
Discourse.reset();
|
Discourse.reset();
|
||||||
|
|||||||
Reference in New Issue
Block a user