From c5f5795bef35f48b44d105168e7bbe353c71ecc8 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Mon, 10 Sep 2018 23:18:11 -0400 Subject: js: add cache callback, template callback, and singleton run callback tests --- js/test/template.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'js/test/template.js') diff --git a/js/test/template.js b/js/test/template.js index a364c61..ebab447 100644 --- a/js/test/template.js +++ b/js/test/template.js @@ -30,4 +30,29 @@ assert.equal(r, 'foofoofoo'); }); + + it('run with callback', function() { + var t = new Luigi.Template("%{bar}foo%{bar}"), + r = []; + + t.run({ + bar: 'foo', + }, function(s) { + r.push(s); + }); + + assert.equal(r.join(''), 'foofoofoo'); + }); + + it('run singleton with callback', function() { + var r = []; + + Luigi.run('%{bar}foo%{bar}', { + bar: 'foo', + }, null, function(s) { + r.push(s); + }); + + assert.equal(r.join(''), 'foofoofoo'); + }); })(); -- cgit v1.2.3