0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 09:20:29 +01:00

DEV: Change embedded response with helper values

Dieser Commit ist enthalten in:
jumagura 2022-12-21 12:24:39 -04:00
Ursprung 2a38aabdca
Commit ced9d768fb

Datei anzeigen

@ -5,6 +5,11 @@ import {
} from "discourse/tests/helpers/qunit-helpers"; } from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit"; import { test } from "qunit";
import { findAll, settled, visit } from "@ember/test-helpers"; import { findAll, settled, visit } from "@ember/test-helpers";
import {
getCustomFields,
getUnsubscribedAdminWizards,
getWizard,
} from "../helpers/admin-wizard";
acceptance("Admin | Custom Fields", function (needs) { acceptance("Admin | Custom Fields", function (needs) {
needs.user(); needs.user();
@ -15,308 +20,13 @@ acceptance("Admin | Custom Fields", function (needs) {
needs.pretender((server, helper) => { needs.pretender((server, helper) => {
server.get("/admin/wizards/wizard", () => { server.get("/admin/wizards/wizard", () => {
return helper.response({ return helper.response(getWizard);
wizard_list: [
{ id: "this_is_testing_wizard", name: "This is testing wizard" },
],
field_types: {
text: {
min_length: null,
max_length: null,
prefill: null,
char_counter: null,
validations: null,
placeholder: null,
},
textarea: {
min_length: null,
max_length: null,
prefill: null,
char_counter: null,
placeholder: null,
},
composer: {
min_length: null,
max_length: null,
char_counter: null,
placeholder: null,
},
text_only: {},
composer_preview: { preview_template: null },
date: { format: "YYYY-MM-DD" },
time: { format: "HH:mm" },
date_time: { format: "" },
number: {},
checkbox: {},
url: { min_length: null },
upload: { file_types: ".jpg,.jpeg,.png" },
dropdown: { prefill: null, content: null },
tag: { limit: null, prefill: null, content: null, tag_groups: null },
category: { limit: 1, property: "id", prefill: null, content: null },
group: { prefill: null, content: null },
user_selector: {},
},
realtime_validations: {
similar_topics: {
types: ["text"],
component: "similar-topics-validator",
backend: true,
required_params: [],
},
},
custom_fields: [
{
id: "external",
klass: "category",
name: "require_topic_approval",
type: "boolean",
serializers: null,
},
{
id: "external",
klass: "category",
name: "require_reply_approval",
type: "boolean",
serializers: null,
},
{
id: "external",
klass: "category",
name: "num_auto_bump_daily",
type: "integer",
serializers: null,
},
{
id: "external",
klass: "category",
name: "has_chat_enabled",
type: "boolean",
serializers: null,
},
{
id: "external",
klass: "post",
name: "missing uploads",
type: "json",
serializers: null,
},
{
id: "external",
klass: "post",
name: "missing uploads ignored",
type: "boolean",
serializers: null,
},
{
id: "external",
klass: "post",
name: "notice",
type: "json",
serializers: null,
},
{
id: "external",
klass: "post",
name: "local_dates",
type: "json",
serializers: null,
},
{
id: "external",
klass: "post",
name: "has_polls",
type: "boolean",
serializers: null,
},
],
});
}); });
server.get("/admin/wizards", () => { server.get("/admin/wizards", () => {
return helper.response({ return helper.response(getUnsubscribedAdminWizards);
subscribed: false,
subscription_type: "none",
subscription_attributes: {
wizard: {
required: {
none: [],
standard: ["*"],
business: ["*"],
community: ["*"],
},
permitted: {
none: [],
standard: ["*"],
business: ["*"],
community: ["*"],
},
restart_on_revisit: {
none: [],
standard: ["*"],
business: ["*"],
community: ["*"],
},
},
step: {
condition: {
none: [],
standard: ["*"],
business: ["*"],
community: ["*"],
},
required_data: {
none: [],
standard: ["*"],
business: ["*"],
community: ["*"],
},
permitted_params: {
none: [],
standard: ["*"],
business: ["*"],
community: ["*"],
},
},
field: {
condition: {
none: [],
standard: ["*"],
business: ["*"],
community: ["*"],
},
type: {
none: [
"text",
"textarea",
"text_only",
"date",
"time",
"date_time",
"number",
"checkbox",
"dropdown",
"upload",
],
standard: ["*"],
business: ["*"],
community: ["*"],
},
realtime_validations: {
none: [],
standard: ["*"],
business: ["*"],
community: ["*"],
},
},
action: {
type: {
none: [
"create_topic",
"update_profile",
"open_composer",
"route_to",
],
standard: [
"create_topic",
"update_profile",
"open_composer",
"route_to",
"send_message",
"watch_categories",
"add_to_group",
],
business: ["*"],
community: ["*"],
},
},
custom_field: {
klass: {
none: ["topic", "post"],
standard: ["topic", "post"],
business: ["*"],
community: ["*"],
},
type: {
none: ["string", "boolean", "integer"],
standard: ["string", "boolean", "integer"],
business: ["*"],
community: ["*"],
},
},
api: {
all: { none: [], standard: [], business: ["*"], community: ["*"] },
},
},
subscription_client_installed: false,
});
}); });
server.get("/admin/wizards/custom-fields", () => { server.get("/admin/wizards/custom-fields", () => {
return helper.response({ return helper.response(getCustomFields);
custom_fields: [
{
id: "external",
klass: "category",
name: "require_topic_approval",
type: "boolean",
serializers: null,
},
{
id: "external",
klass: "category",
name: "require_reply_approval",
type: "boolean",
serializers: null,
},
{
id: "external",
klass: "category",
name: "num_auto_bump_daily",
type: "integer",
serializers: null,
},
{
id: "external",
klass: "category",
name: "has_chat_enabled",
type: "boolean",
serializers: null,
},
{
id: "external",
klass: "post",
name: "missing uploads",
type: "json",
serializers: null,
},
{
id: "external",
klass: "post",
name: "missing uploads ignored",
type: "boolean",
serializers: null,
},
{
id: "external",
klass: "post",
name: "notice",
type: "json",
serializers: null,
},
{
id: "external",
klass: "post",
name: "local_dates",
type: "json",
serializers: null,
},
{
id: "external",
klass: "post",
name: "has_polls",
type: "boolean",
serializers: null,
},
],
});
}); });
}); });