diff --git a/view/ejs/ejs_test.js b/view/ejs/ejs_test.js index 57cb9b12..195625d1 100644 --- a/view/ejs/ejs_test.js +++ b/view/ejs/ejs_test.js @@ -103,4 +103,27 @@ test("easy hookup", function(){ ok( div.find('div').hasClass('yes'), "has yes" ) }); +test("helpers", function() { + $.EJS.Helpers.prototype.simpleHelper = function() + { + return 'Simple'; + } + + $.EJS.Helpers.prototype.elementHelper = function() + { + return function(el) { + el.innerHTML = 'Simple'; + } + } + + var text = "
<%= simpleHelper() %>
"; + var compiled = new $.EJS({text: text}).render() ; + equals(compiled, "
Simple
"); + + text = "
>
"; + compiled = new $.EJS({text: text}).render() ; + $('#qunit-test-area').append($(compiled)); + equals($('#hookup').html(), "Simple"); +}); + })