Если это поможет, вот тест QUnit для воспроизведения проблемы:
// plugins/discourse-calendar/test/javascripts/acceptance/post-event-builder-custom-tags-test.js
import { click, find, visit, fillIn } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { i18n } from "discourse-i18n";
acceptance("Discourse Calendar — Форма нового события с пользовательскими полями", function (needs) {
needs.user({ admin: true, can_create_discourse_post_event: true });
needs.settings({
discourse_local_dates_enabled: true,
calendar_enabled: true,
discourse_post_event_enabled: true,
discourse_post_event_allowed_on_groups: "",
discourse_post_event_allowed_custom_fields: "my_custom_field",
coopaname_integration_enabled: false,
});
test("заполнение формы в редакторе MD заполняет пользовательские поля", async function (assert) {
await ensureEventTagHasFields(assert, 'md');
});
test("заполнение формы в редакторе WYSIWYG заполняет пользовательские поля", async function (assert) {
await ensureEventTagHasFields(assert, 'wysiwyg');
});
});
async function ensureEventTagHasFields(assert, editorType){
await visit("/");
await click('#create-topic');
const categoryChooser = selectKit(".category-chooser");
await categoryChooser.expand();
await categoryChooser.selectRowByValue(2);
await switchEditorTo(editorType);
await click(".toolbar-menu__options-trigger");
await click(`button[title='${i18n("discourse_post_event.builder_modal.attach")}']`);
await fillIn('input.custom-field-input', 'some value');
await click('.d-modal__footer > button');
await switchEditorTo('md');
const fields = ['start', 'status', 'timezone', 'myCustomField'];
const content = await find(".d-editor-input").value;
fields.forEach((field) => {
assert.true(content.includes(`${field}="`), `${field} присутствует в теге события`);
});
}
async function switchEditorTo(type){
const editorSwitch = find('button.composer-toggle-switch');
const isInMarkdown = editorSwitch.attributes['aria-checked'].value === 'false';
if ((isInMarkdown && type === 'wysiwyg') || (!isInMarkdown && type === 'md')) {
await click(editorSwitch);
}
}