clean up callbacks during acceptance tests

This commit is contained in:
Sam 2018-05-24 15:28:54 +10:00
parent 4194886b62
commit 70179290f3
2 changed files with 6 additions and 0 deletions

View File

@ -16,6 +16,10 @@ import { userPath } from 'discourse/lib/url';
const customPostMessageCallbacks = {};
export function resetCustomPostMessageCallbacks() {
customPostMessageCallbacks = {};
}
export function registerCustomPostMessageCallback(type, callback) {
if (customPostMessageCallbacks[type]) {
throw `Error ${type} is an already registered post message!`;

View File

@ -10,6 +10,7 @@ import { flushMap } from 'discourse/models/store';
import { clearRewrites } from 'discourse/lib/url';
import { initSearchData } from 'discourse/widgets/search-menu';
import { resetDecorators } from 'discourse/widgets/widget';
import { resetCustomPostMessageCallbacks } from 'discourse/controllers/topic';
export function currentUser() {
return Discourse.User.create(sessionFixtures['/session/current.json'].current_user);
@ -107,6 +108,7 @@ export function acceptance(name, options) {
clearRewrites();
initSearchData();
resetDecorators();
resetCustomPostMessageCallbacks();
Discourse.reset();
}
});