Ensure _.template works with "interpolate" delimiters containing ternary operators. [closes #68]

Former-commit-id: 287df2ef5802ea6db743da5f211e480d6b0f85c9
This commit is contained in:
John-David Dalton
2012-09-07 21:17:00 -07:00
parent 958ac72805
commit 2dc53223e5
2 changed files with 6 additions and 1 deletions

View File

@@ -1499,6 +1499,11 @@
var compiled = _.template('<span class="icon-<%= type %>2"></span>');
equal(compiled({ 'type': 1 }), '<span class="icon-12"></span>');
});
test('should work with "interpolate" delimiters containing ternary operators', function() {
var compiled = _.template('<%= value ? value : "b" %>');
equal(compiled({ 'value': 'a' }), 'a');
});
}());
/*--------------------------------------------------------------------------*/