0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-09 18:01:48 +08:00
discourse/plugins/discourse-post-voting/test/javascripts/acceptance/category-edit-test.js
Martin Brennan d41418ec01
DEV: Remove enable_simplified_category_creation old code (#40108)
Now that enable_simplified_category_creation is permanent, we can remove
all the old code in the false condition of this upcoming change.

Since now admins can also add/remove category types in the General tab,
I am also removing the settings connectors for topic voting + solved
plugins, removing more clutter from the Settings tab:
2026-05-27 10:04:46 +10:00

42 lines
1.4 KiB
JavaScript
Vendored

import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import pretender from "discourse/tests/helpers/create-pretender";
import formKit from "discourse/tests/helpers/form-kit-helper";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
function latestCategorySavePayload() {
const request = pretender.handledRequests.findLast(
({ method, requestBody }) => method === "PUT" && requestBody
);
return JSON.parse(request.requestBody);
}
acceptance("Category Edit", function (needs) {
needs.user();
needs.settings({ post_voting_enabled: true });
test("Editing the category to create_as_post_voting_default", async function (assert) {
await visit("/c/bug/edit/settings");
await formKit()
.field("custom_fields.create_as_post_voting_default")
.toggle();
await click(".admin-changes-banner .btn-primary");
const payload = latestCategorySavePayload();
assert.true(payload.custom_fields.create_as_post_voting_default);
});
test("Editing the category to only_post_voting_in_this_category", async function (assert) {
await visit("/c/bug/edit/settings");
await formKit()
.field("custom_fields.only_post_voting_in_this_category")
.toggle();
await click(".admin-changes-banner .btn-primary");
const payload = latestCategorySavePayload();
assert.true(payload.custom_fields.only_post_voting_in_this_category);
});
});