mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 02:50:00 +08:00
DEV: Clear NavItem.customNavItemHrefs
between tests (#13025)
Identical callbacks can pile up during tests and cause all sort of weird problems that are difficult to debug. This commit clears registered callbacks after each test.
This commit is contained in:
parent
a7a2887df0
commit
9ec5f39764
|
@ -301,6 +301,10 @@ export function customNavItemHref(cb) {
|
|||
NavItem.customNavItemHrefs.push(cb);
|
||||
}
|
||||
|
||||
export function clearCustomNavItemHref() {
|
||||
NavItem.customNavItemHrefs.clear();
|
||||
}
|
||||
|
||||
export function addNavItem(item) {
|
||||
NavItem.extraNavItemDescriptors.push(item);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ import { setTopicList } from "discourse/lib/topic-list-tracker";
|
|||
import sinon from "sinon";
|
||||
import siteFixtures from "discourse/tests/fixtures/site-fixtures";
|
||||
import { clearResolverOptions } from "discourse-common/resolver";
|
||||
import { clearCustomNavItemHref } from "discourse/models/nav-item";
|
||||
|
||||
const LEGACY_ENV = !setupApplicationTest;
|
||||
|
||||
|
@ -260,6 +261,7 @@ export function acceptance(name, optionsOrCallback) {
|
|||
resetUsernameDecorators();
|
||||
resetOneboxCache();
|
||||
resetCustomPostMessageCallbacks();
|
||||
clearCustomNavItemHref();
|
||||
setTopicList(null);
|
||||
_clearSnapshots();
|
||||
setURLContainer(null);
|
||||
|
|
Loading…
Reference in New Issue
Block a user