File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
src/test/java/com/github/underscore Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -257,6 +257,19 @@ public void templateEach() {
257257 put ("evaluate" , "<%([\\ s\\ S]+?)%>" ); } });
258258 }
259259
260+ @ Test
261+ public void templateEach2 () {
262+ $ .templateSettings (new HashMap <String , String >() { { put ("interpolate" , "\\ $\\ {([\\ s\\ S]+?)\\ }" );
263+ put ("evaluate" , "\\ {\\ {([\\ s\\ S]+?)\\ }\\ }" ); } });
264+ String list = "{{ _.each(items, function(item) { }} <li>${ item }</li> {{ }); }}" ;
265+ Template <Set <Map .Entry <String , Object >>> compiled3 = $ .template (list );
266+ assertEquals (" <li>moe</li> <li>curly</li> <li>larry</li> " ,
267+ compiled3 .apply ((new LinkedHashMap <String , Object >() { {
268+ put ("items" , asList ("moe" , "curly" , "larry" )); } }).entrySet ()));
269+ $ .templateSettings (new HashMap <String , String >() { { put ("interpolate" , "<%=([\\ s\\ S]+?)%>" );
270+ put ("evaluate" , "<%([\\ s\\ S]+?)%>" ); } });
271+ }
272+
260273/*
261274var template = _.template("<b><%- value %></b>");
262275template({value: '<script>'});
You can’t perform that action at this time.
0 commit comments