Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

Commit

Permalink
New method for testing, we create both jade and html templates and
Browse files Browse the repository at this point in the history
we check if the `.render` method is identical
  • Loading branch information
mquandalle committed Mar 31, 2014
1 parent 56c4a29 commit 57fbbff
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 3 deletions.
7 changes: 4 additions & 3 deletions package.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ Package._transitional_registerBuildPlugin({
Package.on_test(function (api) {
api.use("jade");
api.use("tinytest");
api.add_files("tests/tests.jade");
api.add_files("tests/client.js", "client");
api.add_files("tests/server.js", "server");
api.use(["ui", "spacebars", "templating"]);
api.add_files(["tests/runtime.jade", "tests/match.jade", "tests/match.html"]);
api.add_files(["tests/runtime.js", "tests/match.js"], "client");
api.add_files("tests/compile.js", "server");
});
File renamed without changes.
3 changes: 3 additions & 0 deletions tests/match.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template name="match-html-htmlarg"><p id="{{paragraphId}}"></p></template>

<template name="match-html-inclusionwithargs">{{> myTemplate arg1=arg1 arg2=arg2}}</template>
5 changes: 5 additions & 0 deletions tests/match.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
template(name="match-jade-htmlarg")
p(id=paragraphId)

template(name="match-jade-inclusionwithargs")
+myTemplate arg1=arg1 arg2=arg2
12 changes: 12 additions & 0 deletions tests/match.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
var tests = {
'htmlarg': "it should interpolate expressions inside html arguments",
'inclusionwithargs': "it should include the template with arguments"
};

Tinytest.add('Jade - Compiled template match Spacebars', function (test) {
_.each(tests, function(desc, name) {
var jadeTpl = Template[["match", "jade", name].join("-")];
var htmlTpl = Template[["match", "html", name].join("-")];
test.equal(jadeTpl.render.toString(), htmlTpl.render.toString(), desc);
});
});
File renamed without changes.
File renamed without changes.

0 comments on commit 57fbbff

Please sign in to comment.