From 9645cbea26a6871665993563492f32cbe4beb959 Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Mon, 8 Aug 2022 19:57:56 +0200 Subject: [PATCH] DEV: Clear extra header buttons (#17829) --- app/assets/javascripts/discourse/app/widgets/header.js | 6 +++++- .../javascripts/discourse/tests/helpers/qunit-helpers.js | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/app/widgets/header.js b/app/assets/javascripts/discourse/app/widgets/header.js index 0c445bbe37c..bbb665c6083 100644 --- a/app/assets/javascripts/discourse/app/widgets/header.js +++ b/app/assets/javascripts/discourse/app/widgets/header.js @@ -14,12 +14,16 @@ import { logSearchLinkClick } from "discourse/lib/search"; import RenderGlimmer from "discourse/widgets/render-glimmer"; import { hbs } from "ember-cli-htmlbars"; -const _extraHeaderIcons = []; +let _extraHeaderIcons = []; export function addToHeaderIcons(icon) { _extraHeaderIcons.push(icon); } +export function clearExtraHeaderIcons() { + _extraHeaderIcons = []; +} + const dropdown = { buildClasses(attrs) { let classes = attrs.classNames || []; diff --git a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js index 965f16710ba..205e7f61925 100644 --- a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js +++ b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js @@ -71,6 +71,7 @@ import { } from "discourse/lib/to-markdown"; import { clearTagsHtmlCallbacks } from "discourse/lib/render-tags"; import { clearToolbarCallbacks } from "discourse/components/d-editor"; +import { clearExtraHeaderIcons } from "discourse/widgets/header"; import { resetSidebarSection } from "discourse/lib/sidebar/custom-sections"; import { resetNotificationTypeRenderers } from "discourse/lib/notification-item"; @@ -202,6 +203,7 @@ export function testCleanup(container, app) { clearToolbarCallbacks(); resetSidebarSection(); resetNotificationTypeRenderers(); + clearExtraHeaderIcons(); } export function discourseModule(name, options) {