Skip to content

Commit

Permalink
fix(Admin UI): generate manual dropdown category id without errors (#…
Browse files Browse the repository at this point in the history
…2330)

fixes #2325
  • Loading branch information
sleidig authored Apr 2, 2024
1 parent 6b23f0f commit 043914f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,22 @@ describe("AdminEntityFieldComponent", () => {
generateIdFromLabel("test label"),
);
}));
it("should generate manually created 'additional' value for configurable-enum", fakeAsync(() => {
const dataTypeForm = component.schemaFieldsForm.get("dataType");
dataTypeForm.setValue(ConfigurableEnumDatatype.dataType);
tick();

let newAdditional;
component
.createNewAdditionalOptionAsync("newEnumId")
.then((result) => (newAdditional = result));
tick();

expect(newAdditional).toEqual({
label: "newEnumId",
value: "newEnumId",
});
}));

it("should init 'additional' options for entity datatypes", fakeAsync(() => {
const mockEntityTypes = [Entity, RecurringActivity];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export class AdminEntityFieldComponent implements OnChanges {
objectToValue = (v: SimpleDropdownValue) => v?.value;
createNewAdditionalOption: (input: string) => SimpleDropdownValue;
createNewAdditionalOptionAsync = async (input) =>
this.createNewAdditionalOptionAsync(input);
this.createNewAdditionalOption(input);

private updateDataTypeAdditional(dataType: string) {
this.resetAdditional();
Expand Down

0 comments on commit 043914f

Please sign in to comment.