Skip to content

Commit

Permalink
Add tests for argument provided HtmxResponse.Builder
Browse files Browse the repository at this point in the history
  • Loading branch information
checketts committed Aug 7, 2024
1 parent d66ed8c commit ef427c8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ public void throwException() {
throw new RuntimeException("Fake exception");
}

@GetMapping("/argument")
public String argument(HtmxResponse.Builder htmxResponse) {
htmxResponse.trigger("event1");
return "argument";
}



@ExceptionHandler(Exception.class)
public HtmxResponse handleError(Exception ex) {
return HtmxResponse.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,11 @@ public void testException() throws Exception {
<span>Fake exception</span>
</span>""");
}

@Test
public void testHxTriggerArgument() throws Exception {
mockMvc.perform(get("/hvhi/argument"))
.andExpect(status().isOk())
.andExpect(header().string("HX-Trigger", "event1"));
}
}
Empty file.

0 comments on commit ef427c8

Please sign in to comment.