diff --git a/packages/showdown/package.js b/packages/showdown/package.js
index fce2144782..07463796e0 100644
--- a/packages/showdown/package.js
+++ b/packages/showdown/package.js
@@ -13,3 +13,7 @@ Package.on_use(function (api) {
api.use("ui", "client", {weak: true});
api.add_files('template-integration.js', 'client');
});
+
+Package.on_test(function (api) {
+ api.use("ui", "client");
+});
diff --git a/packages/spacebars-tests/package.js b/packages/spacebars-tests/package.js
index 4d9ffa2689..741cbc8710 100644
--- a/packages/spacebars-tests/package.js
+++ b/packages/spacebars-tests/package.js
@@ -10,6 +10,7 @@ Package.on_test(function (api) {
api.use('tinytest');
api.use('jquery');
api.use('test-helpers');
+ api.use('showdown');
api.use('templating', 'client');
api.add_files([
diff --git a/packages/spacebars-tests/template_tests.html b/packages/spacebars-tests/template_tests.html
index b8ed4479c4..a9507f0bc3 100644
--- a/packages/spacebars-tests/template_tests.html
+++ b/packages/spacebars-tests/template_tests.html
@@ -286,3 +286,94 @@
{{this}}
{{/with}}
+
+
+ {{#markdown}}
+{{hi}}
+/each}}
+
+{{hi}}
+/each}}
+
+* {{hi}}
+* /each}}
+
+* {{hi}}
+* /each}}
+
+ {{hi}}
+ /each}}
+
+ {{hi}}
+ /each
+
+>
+* >
+`>`
+ >
+
+>
+* >
+`>`
+ >
+
+`{{hi}}`
+`/each}}`
+
+`{{hi}}`
+`/each}}`
+
+ {{/markdown}}
+
+
+
+ {{#markdown}}
+
+{{#if cond}}true{{else}}false{{/if}}
+{{#if cond}}true{{else}}false{{/if}}
+* {{#if cond}}true{{else}}false{{/if}}
+* {{#if cond}}true{{else}}false{{/if}}
+ {{#if cond}}true{{else}}false{{/if}}
+ {{#if cond}}true{{else}}false{{/if}}
+`{{#if cond}}true{{else}}false{{/if}}`
+`{{#if cond}}true{{else}}false{{/if}}`
+
+ {{/markdown}}
+
+
+
+ {{#markdown}}
+
+{{#each seq}}{{.}}{{/each}}
+{{#each seq}}{{.}}{{/each}}
+* {{#each seq}}{{.}}{{/each}}
+* {{#each seq}}{{.}}{{/each}}
+ {{#each seq}}{{.}}{{/each}}
+ {{#each seq}}{{.}}{{/each}}
+`{{#each seq}}{{.}}{{/each}}`
+`{{#each seq}}{{.}}{{/each}}`
+
+ {{/markdown}}
+
+
+
+ {{#markdown}}
+{{> spacebars_template_test_markdown_inclusion_subtmpl}}
+ {{/markdown}}
+
+
+
+ Nothing in particular
+
+
+
+ {{#markdown}}
+ {{#spacebars_template_test_just_content}}
+Hi there!
+ {{/spacebars_template_test_just_content}}
+ {{/markdown}}
+
+
+
+ {{> content}}
+
diff --git a/packages/spacebars-tests/template_tests.js b/packages/spacebars-tests/template_tests.js
index dc9b0bc356..706b6a92c5 100644
--- a/packages/spacebars-tests/template_tests.js
+++ b/packages/spacebars-tests/template_tests.js
@@ -930,3 +930,55 @@ Tinytest.add('spacebars - templates - constant #each argument', function (test)
test.equal(trim(stripComments(div.innerHTML)).replace(/\s+/g, ' '),
'foo bar 2');
});
+
+// @returns {String} simplified html content
+var divContentForMarkdown = function (div) {
+ return trim(stripComments(div.innerHTML))
+ .replace(/\
/g, '\n');
+};
+
+Tinytest.add('spacebars - templates - #markdown - basic', function (test) {
+ var tmpl = Template.spacebars_template_test_markdown_basic;
+ tmpl.hi = function () {
+ return "hi";
+ };
+ var div = renderToDiv(tmpl);
+ test.equal(divContentForMarkdown(div), "FIXME");
+});
+
+Tinytest.add('spacebars - templates - #markdown - if', function (test) {
+ var tmpl = Template.spacebars_template_test_markdown_if;
+ var R = new ReactiveVar(false);
+ tmpl.cond = function () { return R.get(); };
+
+ var div = renderToDiv(tmpl);
+ test.equal(divContentForMarkdown(div), "FIXME(false)");
+ R.set(true);
+ Deps.flush();
+ test.equal(divContentForMarkdown(div), "FIXME(true)");
+});
+
+Tinytest.add('spacebars - templates - #markdown - each', function (test) {
+ var tmpl = Template.spacebars_template_test_markdown_each;
+ var R = new ReactiveVar([]);
+ tmpl.seq = function () { return R.get(); };
+
+ var div = renderToDiv(tmpl);
+ test.equal(divContentForMarkdown(div), "FIXME([])");
+ R.set(["item"]);
+ Deps.flush();
+ test.equal(divContentForMarkdown(div), "FIXME([\"item\"])");
+});
+
+Tinytest.add('spacebars - templates - #markdown - inclusion', function (test) {
+ var tmpl = Template.spacebars_template_test_markdown_inclusion;
+ var div = renderToDiv(tmpl);
+ test.equal(divContentForMarkdown(div), "
Nothing in particular
"); +}); + +Tinytest.add('spacebars - templates - #markdown - block helpers', function (test) { + var tmpl = Template.spacebars_template_test_markdown_block_helpers; + var div = renderToDiv(tmpl); + test.equal(divContentForMarkdown(div), "Hi there!
"); +}); +