aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/README.mkd2
-rw-r--r--js/test/cache.js13
-rw-r--r--js/test/template.js25
3 files changed, 39 insertions, 1 deletions
diff --git a/js/README.mkd b/js/README.mkd
index 939fda9..0383a79 100644
--- a/js/README.mkd
+++ b/js/README.mkd
@@ -20,7 +20,7 @@ Installation
Minify `luigi-template.js` using your minifier of choice, and drop it
into your source tree. I like [jsmin][], personally:
- jsmin luigi-template.js > luigi-template.min.js
+ jsmin < luigi-template.js > luigi-template.min.js
*Note:* If you are upgrading from a pre-0.5.0 version of Luigi Template,
be sure to include `luigi-compat.js` as well. See the *Changes in
diff --git a/js/test/cache.js b/js/test/cache.js
index 9395223..710488a 100644
--- a/js/test/cache.js
+++ b/js/test/cache.js
@@ -38,6 +38,19 @@
assert.equal(r, 'foofoo');
});
+ it('cache run with callback', function() {
+ var r = [];
+
+ Luigi.cache({
+ foo: 'foo%{bar}',
+ }).run('foo', {
+ bar: 'foo',
+ }, function(s) {
+ r.push(s);
+ });
+
+ assert.equal(r.join(''), 'foofoo');
+ });
it('cache with custom filters', function() {
var cache = Luigi.cache({
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');
+ });
})();