DEV: Fix build due to 3a4f4abdc9 (#26151)

This commit is contained in:
Alan Guo Xiang Tan 2024-03-13 10:32:45 +08:00 committed by GitHub
parent e5020617c1
commit 63dd08ad59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 37 additions and 28 deletions

View File

@ -7,6 +7,7 @@ import { queryAll } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper"; import selectKit from "discourse/tests/helpers/select-kit-helper";
import I18n from "discourse-i18n"; import I18n from "discourse-i18n";
import AdminSchemaThemeSettingEditor from "admin/components/schema-theme-setting/editor"; import AdminSchemaThemeSettingEditor from "admin/components/schema-theme-setting/editor";
import ThemeSettings from "admin/models/theme-settings";
class TreeFromDOM { class TreeFromDOM {
constructor() { constructor() {
@ -294,29 +295,33 @@ module(
}); });
test("input fields are rendered even if they're not present in the data", async function (assert) { test("input fields are rendered even if they're not present in the data", async function (assert) {
const schema = { const setting = ThemeSettings.create({
name: "something", setting: "objects_setting",
identifier: "id", objects_schema: {
properties: { name: "something",
id: { identifier: "id",
type: "string", properties: {
}, id: {
name: { type: "string",
type: "string", },
name: {
type: "string",
},
}, },
}, },
}; value: [
const data = [ {
{ id: "bu1",
id: "bu1", name: "Big U",
name: "Big U", },
}, {
{ id: "fi2",
id: "fi2", },
}, ],
]; });
await render(<template> await render(<template>
<AdminSchemaThemeSettingEditor @schema={{schema}} @data={{data}} /> <AdminSchemaThemeSettingEditor @themeId="1" @setting={{setting}} />
</template>); </template>);
const inputFields = new InputFieldsFromDOM(); const inputFields = new InputFieldsFromDOM();
@ -414,9 +419,10 @@ module(
}); });
test("input fields of type float", async function (assert) { test("input fields of type float", async function (assert) {
const [schema, data] = schemaAndData(3); const setting = schemaAndData(3);
await render(<template> await render(<template>
<AdminSchemaThemeSettingEditor @schema={{schema}} @data={{data}} /> <AdminSchemaThemeSettingEditor @themeId="1" @setting={{setting}} />
</template>); </template>);
const inputFields = new InputFieldsFromDOM(); const inputFields = new InputFieldsFromDOM();
@ -501,9 +507,10 @@ module(
}); });
test("input fields of type category", async function (assert) { test("input fields of type category", async function (assert) {
const [schema, data] = schemaAndData(3); const setting = schemaAndData(3);
await render(<template> await render(<template>
<AdminSchemaThemeSettingEditor @schema={{schema}} @data={{data}} /> <AdminSchemaThemeSettingEditor @themeId="1" @setting={{setting}} />
</template>); </template>);
const inputFields = new InputFieldsFromDOM(); const inputFields = new InputFieldsFromDOM();
@ -530,9 +537,10 @@ module(
}); });
test("input fields of type tag", async function (assert) { test("input fields of type tag", async function (assert) {
const [schema, data] = schemaAndData(3); const setting = schemaAndData(3);
await render(<template> await render(<template>
<AdminSchemaThemeSettingEditor @schema={{schema}} @data={{data}} /> <AdminSchemaThemeSettingEditor @themeId="1" @setting={{setting}} />
</template>); </template>);
const inputFields = new InputFieldsFromDOM(); const inputFields = new InputFieldsFromDOM();
@ -567,9 +575,10 @@ module(
]); ]);
}); });
const [schema, data] = schemaAndData(3); const setting = schemaAndData(3);
await render(<template> await render(<template>
<AdminSchemaThemeSettingEditor @schema={{schema}} @data={{data}} /> <AdminSchemaThemeSettingEditor @themeId="1" @setting={{setting}} />
</template>); </template>);
const inputFields = new InputFieldsFromDOM(); const inputFields = new InputFieldsFromDOM();