DEV: Clear all navItem information between tests (#13903)

Expands the original `clearCustomNavItemHref` from #13025. Fixes issues with discourse-assign tests.
This commit is contained in:
Jarek Radosz 2021-07-30 18:05:04 +02:00 committed by GitHub
parent 0ac2cfa68c
commit f740c1a952
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -301,8 +301,10 @@ export function customNavItemHref(cb) {
NavItem.customNavItemHrefs.push(cb);
}
export function clearCustomNavItemHref() {
export function clearNavItems() {
NavItem.customNavItemHrefs.clear();
NavItem.extraArgsCallbacks.clear();
NavItem.extraNavItemDescriptors.clear();
}
export function addNavItem(item) {

View File

@ -40,7 +40,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";
import { clearNavItems } from "discourse/models/nav-item";
import {
cleanUpComposerUploadHandler,
cleanUpComposerUploadMarkdownResolver,
@ -274,7 +274,7 @@ export function acceptance(name, optionsOrCallback) {
resetOneboxCache();
resetCustomPostMessageCallbacks();
resetUserSearchCache();
clearCustomNavItemHref();
clearNavItems();
setTopicList(null);
_clearSnapshots();
setURLContainer(null);