clean up callbacks during acceptance tests
This commit is contained in:
parent
4194886b62
commit
70179290f3
|
@ -16,6 +16,10 @@ import { userPath } from 'discourse/lib/url';
|
||||||
|
|
||||||
const customPostMessageCallbacks = {};
|
const customPostMessageCallbacks = {};
|
||||||
|
|
||||||
|
export function resetCustomPostMessageCallbacks() {
|
||||||
|
customPostMessageCallbacks = {};
|
||||||
|
}
|
||||||
|
|
||||||
export function registerCustomPostMessageCallback(type, callback) {
|
export function registerCustomPostMessageCallback(type, callback) {
|
||||||
if (customPostMessageCallbacks[type]) {
|
if (customPostMessageCallbacks[type]) {
|
||||||
throw `Error ${type} is an already registered post message!`;
|
throw `Error ${type} is an already registered post message!`;
|
||||||
|
|
|
@ -10,6 +10,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 { resetCustomPostMessageCallbacks } from 'discourse/controllers/topic';
|
||||||
|
|
||||||
export function currentUser() {
|
export function currentUser() {
|
||||||
return Discourse.User.create(sessionFixtures['/session/current.json'].current_user);
|
return Discourse.User.create(sessionFixtures['/session/current.json'].current_user);
|
||||||
|
@ -107,6 +108,7 @@ export function acceptance(name, options) {
|
||||||
clearRewrites();
|
clearRewrites();
|
||||||
initSearchData();
|
initSearchData();
|
||||||
resetDecorators();
|
resetDecorators();
|
||||||
|
resetCustomPostMessageCallbacks();
|
||||||
Discourse.reset();
|
Discourse.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue