Sorry if this is not the usual way to submit improvement ideas, I didn't know where else to go. Please move it to a more appropriate area if needed.
- Is there a way to control how JAWR generates the messages object to make it more test-friendly?
- Could JAWR have an option to generate a messages function/module instead, that could easily be mocked when needed?
My current workaround is:
This allows me to re-write the first code sample like this.
Here the module is easily testable by injecting a stub getMessage function. However it seems strange to have to re-process an OGNL-like notation to find the right message every time. Could JAWR generate a hashmap of messages, and provide a function to access them? Something like
Or are we missing an existing way to unit test JS code that uses window.messages?