thymeleaf-testing icon indicating copy to clipboard operation
thymeleaf-testing copied to clipboard

Support for custom template modes

Open Kleeven81 opened this issue 12 years ago • 1 comments

Currently it is not possible to use a custom template mode in the testing framework making it impossible to test your own template modes. It would be nice if we could add them in the same way we can add our own Dialects.

Kleeven81 avatar Dec 09 '13 07:12 Kleeven81

I've made a fork and written a simple solution:

  • Added a private list of ITemplateModeHandler
  • Added getter and setter for the list
  • Added addTemplateModeHandler method to add a single handler for convenience
  • during private void execute(final ITestable testable, final TestExecutionContext context) I add all handlers in the list to the TemplateEngine before it is added to the context

I'd be happy to do a pull request but I ran into the following: I wanted to add unit tests for the new code but I couldn't really find where to put them since the tests in https://github.com/thymeleaf/thymeleaf-tests seem to be sorted on functionality instead of package and class.

Kleeven81 avatar Dec 09 '13 07:12 Kleeven81