Ignore ID being passed in for choice/group, fixes some tests

This commit is contained in:
Xon 2024-07-31 10:53:49 +08:00
commit 77f362eb42
4 changed files with 10 additions and 7 deletions

View file

@ -3233,7 +3233,8 @@ var mapInputToChoice = function (value, allowGroup) {
return (0, exports.mapInputToChoice)(e, false);
});
var result_2 = {
id: group.id || 0,
id: 0,
// actual ID will be assigned during _addGroup
label: (0, utils_1.unwrapStringForRaw)(group.label) || group.value,
active: choices.length !== 0,
disabled: !!group.disabled,
@ -3243,8 +3244,10 @@ var mapInputToChoice = function (value, allowGroup) {
}
var choice = groupOrChoice;
var result = {
id: choice.id || 0,
id: 0,
// actual ID will be assigned during _addChoice
groupId: 0,
// actual ID will be assigned during _addGroup but before _addChoice
value: choice.value,
label: choice.label || choice.value,
active: coerceBool(choice.active),

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -36,7 +36,7 @@ export const mapInputToChoice = <T extends string | InputChoice | InputGroup>(
const choices = group.choices.map((e) => mapInputToChoice(e, false));
const result: GroupFull = {
id: group.id || 0,
id: 0, // actual ID will be assigned during _addGroup
label: unwrapStringForRaw(group.label) || group.value,
active: choices.length !== 0,
disabled: !!group.disabled,
@ -49,8 +49,8 @@ export const mapInputToChoice = <T extends string | InputChoice | InputGroup>(
const choice = groupOrChoice;
const result: ChoiceFull = {
id: choice.id || 0,
groupId: 0,
id: 0, // actual ID will be assigned during _addChoice
groupId: 0, // actual ID will be assigned during _addGroup but before _addChoice
value: choice.value,
label: choice.label || choice.value,
active: coerceBool(choice.active),