DEV: Clear clearToolbarCallbacks after each test (#17531)

Fixes leakage between tests. Have a composer toolbar with a 100 "Add emoji" buttons? I gotchu.
This commit is contained in:
Jarek Radosz 2022-07-16 22:57:08 +02:00 committed by GitHub
parent 1b4dea75ee
commit 751a5e1430
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 5 deletions

View File

@ -69,6 +69,7 @@ import {
clearTagDecorateCallbacks, clearTagDecorateCallbacks,
clearTextDecorateCallbacks, clearTextDecorateCallbacks,
} from "discourse/lib/to-markdown"; } from "discourse/lib/to-markdown";
import { clearToolbarCallbacks } from "discourse/components/d-editor";
export function currentUser() { export function currentUser() {
return User.create(sessionFixtures["/session/current.json"].current_user); return User.create(sessionFixtures["/session/current.json"].current_user);
@ -193,6 +194,7 @@ export function testCleanup(container, app) {
clearTextDecorateCallbacks(); clearTextDecorateCallbacks();
clearResolverOptions(); clearResolverOptions();
clearLegacyResolverOptions(); clearLegacyResolverOptions();
clearToolbarCallbacks();
} }
export function discourseModule(name, options) { export function discourseModule(name, options) {

View File

@ -13,7 +13,6 @@ import {
} from "discourse/tests/helpers/textarea-selection-helper"; } from "discourse/tests/helpers/textarea-selection-helper";
import { hbs } from "ember-cli-htmlbars"; import { hbs } from "ember-cli-htmlbars";
import I18n from "I18n"; import I18n from "I18n";
import { clearToolbarCallbacks } from "discourse/components/d-editor";
import formatTextWithSelection from "discourse/tests/helpers/d-editor-helper"; import formatTextWithSelection from "discourse/tests/helpers/d-editor-helper";
import { next } from "@ember/runloop"; import { next } from "@ember/runloop";
import { withPluginApi } from "discourse/lib/plugin-api"; 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) { module("Integration | Component | d-editor", function (hooks) {
setupRenderingTest(hooks); setupRenderingTest(hooks);
hooks.afterEach(function () {
clearToolbarCallbacks();
});
test("preview updates with markdown", async function (assert) { test("preview updates with markdown", async function (assert) {
await render(hbs`<DEditor @value={{this.value}} />`); await render(hbs`<DEditor @value={{this.value}} />`);