From 751a5e1430e7166faa3cae1f64f4f246f0f20aa3 Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Sat, 16 Jul 2022 22:57:08 +0200 Subject: [PATCH] DEV: Clear clearToolbarCallbacks after each test (#17531) Fixes leakage between tests. Have a composer toolbar with a 100 "Add emoji" buttons? I gotchu. --- .../javascripts/discourse/tests/helpers/qunit-helpers.js | 2 ++ .../discourse/tests/integration/components/d-editor-test.js | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js index 18b8efd440f..a7b2cb44568 100644 --- a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js +++ b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js @@ -69,6 +69,7 @@ import { clearTagDecorateCallbacks, clearTextDecorateCallbacks, } from "discourse/lib/to-markdown"; +import { clearToolbarCallbacks } from "discourse/components/d-editor"; export function currentUser() { return User.create(sessionFixtures["/session/current.json"].current_user); @@ -193,6 +194,7 @@ export function testCleanup(container, app) { clearTextDecorateCallbacks(); clearResolverOptions(); clearLegacyResolverOptions(); + clearToolbarCallbacks(); } export function discourseModule(name, options) { diff --git a/app/assets/javascripts/discourse/tests/integration/components/d-editor-test.js b/app/assets/javascripts/discourse/tests/integration/components/d-editor-test.js index 417c412eaf2..3720f70b7fd 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/d-editor-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/d-editor-test.js @@ -13,7 +13,6 @@ import { } from "discourse/tests/helpers/textarea-selection-helper"; import { hbs } from "ember-cli-htmlbars"; import I18n from "I18n"; -import { clearToolbarCallbacks } from "discourse/components/d-editor"; import formatTextWithSelection from "discourse/tests/helpers/d-editor-helper"; import { next } from "@ember/runloop"; import { withPluginApi } from "discourse/lib/plugin-api"; @@ -21,10 +20,6 @@ import { withPluginApi } from "discourse/lib/plugin-api"; module("Integration | Component | d-editor", function (hooks) { setupRenderingTest(hooks); - hooks.afterEach(function () { - clearToolbarCallbacks(); - }); - test("preview updates with markdown", async function (assert) { await render(hbs``);