Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

template.js: Add test for "and" helper.

YashRE4266c12c9022bb
diff --git a/frontend_tests/node_tests/templates.js b/frontend_tests/node_tests/templates.js
new file mode 100644
index 00000000000..d39668be467
--- /dev/null
+++ b/frontend_tests/node_tests/templates.js
@@ -0,0 +1,17 @@
+"use strict";
+
+const {strict: assert} = require("assert");
+
+const {zrequire} = require("../zjsunit/namespace");
+const {run_test} = require("../zjsunit/test");
+
+zrequire("templates");
+
+run_test("and", () => {
+ const args = {
+ last: true,
+ };
+
+ const html = require("./templates/and.hbs")(args);
+ assert.equal(html, "<p>empty and</p>\n<p>last and</p>\n\n");
+});
diff --git a/frontend_tests/node_tests/templates/and.hbs b/frontend_tests/node_tests/templates/and.hbs
new file mode 100644
index 00000000000..3bfc49b3bc3
--- /dev/null
+++ b/frontend_tests/node_tests/templates/and.hbs
@@ -0,0 +1,3 @@
+{{#if (and)}}<p>empty and</p>{{/if}}
+{{#if (and true last)}}<p>last and</p>{{/if}}
+{{#if (and false true)}}<p>false and</p>{{/if}}