0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-23 09:50:28 +01:00
discourse-custom-wizard/test/javascripts/acceptance/admin-custom-fields-test.js

57 Zeilen
1,7 KiB
JavaScript

import {
acceptance,
query,
visible,
} from "discourse/tests/helpers/qunit-helpers";
2022-12-21 16:30:31 +01:00
import { test } from "qunit";
2022-12-21 17:47:34 +01:00
import { findAll, visit } from "@ember/test-helpers";
import {
getCustomFields,
getUnsubscribedAdminWizards,
getWizard,
} from "../helpers/admin-wizard";
acceptance("Admin | Custom Fields", function (needs) {
needs.user();
needs.settings({
custom_wizard_enabled: true,
available_locales: JSON.stringify([{ name: "English", value: "en" }]),
});
needs.pretender((server, helper) => {
server.get("/admin/wizards/wizard", () => {
return helper.response(getWizard);
});
server.get("/admin/wizards", () => {
return helper.response(getUnsubscribedAdminWizards);
});
server.get("/admin/wizards/custom-fields", () => {
return helper.response(getCustomFields);
});
});
2022-12-21 16:30:31 +01:00
test("viewing custom fields tab", async (assert) => {
await visit("/admin/wizards/custom-fields");
assert.ok(find("table"));
assert.ok(findAll("table tbody tr").length === 9);
assert.ok(
query(".message-content").innerText.includes(
"View, create, edit and destroy custom fields"
),
"it displays wizard message"
);
await click(".btn-icon-text");
assert.ok(
visible(".wizard-subscription-selector"),
"custom field class is present"
);
assert.ok(
visible(".wizard-subscription-selector-header"),
"custom field type is present"
);
assert.ok(visible(".input"), "custom field name is present");
assert.ok(visible(".multi-select"), "custom field serializer is present");
assert.ok(visible(".actions"), "custom field action buttons are present");
});
});