Skip to content

Commit

Permalink
fix: duration components in resizing
Browse files Browse the repository at this point in the history
  • Loading branch information
nsenave committed Nov 18, 2024
1 parent f226a9e commit 8e40c8d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ public static List<String> getCollectedVariablesInLoop(Loop loop) {
List<String> result = new ArrayList<>();
loop.getComponents().forEach(component -> {
switch (component.getComponentType()) {
case CHECKBOX_BOOLEAN, INPUT_NUMBER, INPUT, TEXTAREA, DATEPICKER, RADIO, CHECKBOX_ONE, DROPDOWN,
CHECKBOX_GROUP, TABLE ->
case CHECKBOX_BOOLEAN, INPUT_NUMBER, INPUT, TEXTAREA, DATEPICKER, DURATION, RADIO,
CHECKBOX_ONE, DROPDOWN, CHECKBOX_GROUP, TABLE ->
result.addAll(getDirectResponseNames(component));
case ROSTER_FOR_LOOP ->
throw new LunaticLoopException(String.format(
Expand All @@ -133,8 +133,8 @@ public static List<String> getCollectedVariablesInLoop(Loop loop) {
"Pairwise components are forbidden in loops: loop '%s' contains a pairwise component.",
loop.getId()));
default ->
log.debug("(Variables in Lunatic loop) Component of type {} has no response.",
component.getComponentType());
throw new IllegalArgumentException(
"Unexpected component type '" + component.getComponentType() + "'.");
}
});
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ void simpleResponseComponents_resizedVariables() {
datepicker.setResponse(new ResponseType());
datepicker.getResponse().setName("DATE_VAR");
lunaticLoop.getComponents().add(datepicker);
Duration duration = new Duration();
duration.setComponentType(ComponentTypeEnum.DURATION);
duration.setResponse(new ResponseType());
duration.getResponse().setName("DURATION_VAR");
lunaticLoop.getComponents().add(duration);
Dropdown dropdown = new Dropdown();
dropdown.setComponentType(ComponentTypeEnum.DROPDOWN);
dropdown.setResponse(new ResponseType());
Expand All @@ -160,7 +165,7 @@ void simpleResponseComponents_resizedVariables() {
// Then
assertThat(lunaticResizing.getResizingEntry("LOOP_SIZE_VAR").getVariables())
.containsExactlyInAnyOrderElementsOf(Set.of(
"BOOLEAN_VAR", "INPUT_VAR", "TEXT_VAR", "NUMBER_VAR", "DATE_VAR",
"BOOLEAN_VAR", "INPUT_VAR", "TEXT_VAR", "NUMBER_VAR", "DATE_VAR", "DURATION_VAR",
"DROPDOWN_VAR", "RADIO_VAR", "CHECKBOX_VAR"));
}

Expand Down

0 comments on commit 8e40c8d

Please sign in to comment.