Skip to content

Commit 77f362e

Browse files
committed
Ignore ID being passed in for choice/group, fixes some tests
1 parent d3620f5 commit 77f362e

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

public/assets/scripts/choices.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -3233,7 +3233,8 @@ var mapInputToChoice = function (value, allowGroup) {
32333233
return (0, exports.mapInputToChoice)(e, false);
32343234
});
32353235
var result_2 = {
3236-
id: group.id || 0,
3236+
id: 0,
3237+
// actual ID will be assigned during _addGroup
32373238
label: (0, utils_1.unwrapStringForRaw)(group.label) || group.value,
32383239
active: choices.length !== 0,
32393240
disabled: !!group.disabled,
@@ -3243,8 +3244,10 @@ var mapInputToChoice = function (value, allowGroup) {
32433244
}
32443245
var choice = groupOrChoice;
32453246
var result = {
3246-
id: choice.id || 0,
3247+
id: 0,
3248+
// actual ID will be assigned during _addChoice
32473249
groupId: 0,
3250+
// actual ID will be assigned during _addGroup but before _addChoice
32483251
value: choice.value,
32493252
label: choice.label || choice.value,
32503253
active: coerceBool(choice.active),

public/assets/scripts/choices.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/types/src/scripts/choices.d.ts.map

+1-1
Original file line numberDiff line numberDiff line change

src/scripts/lib/choice-input.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const mapInputToChoice = <T extends string | InputChoice | InputGroup>(
3636
const choices = group.choices.map((e) => mapInputToChoice(e, false));
3737

3838
const result: GroupFull = {
39-
id: group.id || 0,
39+
id: 0, // actual ID will be assigned during _addGroup
4040
label: unwrapStringForRaw(group.label) || group.value,
4141
active: choices.length !== 0,
4242
disabled: !!group.disabled,
@@ -49,8 +49,8 @@ export const mapInputToChoice = <T extends string | InputChoice | InputGroup>(
4949
const choice = groupOrChoice;
5050

5151
const result: ChoiceFull = {
52-
id: choice.id || 0,
53-
groupId: 0,
52+
id: 0, // actual ID will be assigned during _addChoice
53+
groupId: 0, // actual ID will be assigned during _addGroup but before _addChoice
5454
value: choice.value,
5555
label: choice.label || choice.value,
5656
active: coerceBool(choice.active),

0 commit comments

Comments
 (0)