Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
template.js: Add test for "rendered_markdown" helper.
YashRE426c0d070b4d5e
diff --git a/frontend_tests/node_tests/templates.js b/frontend_tests/node_tests/templates.jsindex 6a6f48efca2..e76b495929c 100644--- a/frontend_tests/node_tests/templates.js+++ b/frontend_tests/node_tests/templates.js@@ -2,9 +2,12 @@const {strict: assert} = require("assert");-const {zrequire} = require("../zjsunit/namespace");+const {JSDOM} = require("jsdom");++const {set_global, zrequire} = require("../zjsunit/namespace");const {run_test} = require("../zjsunit/test");+set_global("DOMParser", new JSDOM().window.DOMParser);zrequire("templates");run_test("and", () => {@@ -24,3 +27,10 @@ run_test("or", () => {const html = require("./templates/or.hbs")(args);assert.equal(html, "\n<p>last or</p>\n<p>true or</p>\n");});++run_test("rendered_markdown", () => {+ const html = require("./templates/rendered_markdown.hbs")();+ const expected_html =+ '<a href="http://example.com" target="_blank" rel="noopener noreferrer" title="http://example.com/">good</a>\n';+ assert.equal(html, expected_html);+});diff --git a/frontend_tests/node_tests/templates/rendered_markdown.hbs b/frontend_tests/node_tests/templates/rendered_markdown.hbsnew file mode 100644index 00000000000..fe68ef82d62--- /dev/null+++ b/frontend_tests/node_tests/templates/rendered_markdown.hbs@@ -0,0 +1 @@+{{rendered_markdown "<a href='http://example.com'>good</a>"}}