Skip to content

Commit

Permalink
DEV: Clear all navItem information between tests (#13903)
Browse files Browse the repository at this point in the history
Expands the original `clearCustomNavItemHref` from #13025. Fixes issues with discourse-assign tests.
  • Loading branch information
CvX committed Jul 30, 2021
1 parent 0ac2cfa commit f740c1a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion app/assets/javascripts/discourse/app/models/nav-item.js
Expand Up @@ -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) {
Expand Down
Expand Up @@ -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,
Expand Down Expand Up @@ -274,7 +274,7 @@ export function acceptance(name, optionsOrCallback) {
resetOneboxCache();
resetCustomPostMessageCallbacks();
resetUserSearchCache();
clearCustomNavItemHref();
clearNavItems();
setTopicList(null);
_clearSnapshots();
setURLContainer(null);
Expand Down

0 comments on commit f740c1a

Please sign in to comment.