DEV: prevents toolbar callbacks to leak between tests (#9403)
This commit is contained in:
parent
b57d4586d7
commit
058506bb77
|
@ -52,7 +52,7 @@ const OP = {
|
|||
|
||||
const FOUR_SPACES_INDENT = "4-spaces-indent";
|
||||
|
||||
const _createCallbacks = [];
|
||||
let _createCallbacks = [];
|
||||
|
||||
const isInside = (text, regex) => {
|
||||
const matches = text.match(regex);
|
||||
|
@ -212,6 +212,9 @@ class Toolbar {
|
|||
export function addToolbarCallback(func) {
|
||||
_createCallbacks.push(func);
|
||||
}
|
||||
export function clearToolbarCallbacks() {
|
||||
_createCallbacks = [];
|
||||
}
|
||||
|
||||
export function onToolbarCreate(func) {
|
||||
deprecated("`onToolbarCreate` is deprecated, use the plugin api instead.");
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { next } from "@ember/runloop";
|
||||
import { clearToolbarCallbacks } from "discourse/components/d-editor";
|
||||
import componentTest from "helpers/component-test";
|
||||
import { withPluginApi } from "discourse/lib/plugin-api";
|
||||
import formatTextWithSelection from "helpers/d-editor-helper";
|
||||
|
@ -633,6 +634,11 @@ componentTest("emoji", {
|
|||
});
|
||||
this.set("value", "hello world.");
|
||||
},
|
||||
|
||||
afterEach() {
|
||||
clearToolbarCallbacks();
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
jumpEnd(find("textarea.d-editor-input")[0]);
|
||||
await click("button.emoji");
|
||||
|
|
Loading…
Reference in New Issue