From 42a6bad2e3942ff44fa99e6108d930e8db628a5c Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Wed, 13 Jan 2016 15:57:11 -0500 Subject: [PATCH] Add some tests of importing lazy .html template modules. --- tools/tests/apps/modules/imports/lazy.html | 7 +++++++ tools/tests/apps/modules/tests.js | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 tools/tests/apps/modules/imports/lazy.html diff --git a/tools/tests/apps/modules/imports/lazy.html b/tools/tests/apps/modules/imports/lazy.html new file mode 100644 index 0000000000..df3233bbc2 --- /dev/null +++ b/tools/tests/apps/modules/imports/lazy.html @@ -0,0 +1,7 @@ + + {{> lazy}} + + + diff --git a/tools/tests/apps/modules/tests.js b/tools/tests/apps/modules/tests.js index 8c2221d147..f79dc62544 100644 --- a/tools/tests/apps/modules/tests.js +++ b/tools/tests/apps/modules/tests.js @@ -63,6 +63,28 @@ describe("app modules", () => { }); }); +describe("template modules", () => { + Meteor.isClient && + it("should be importable on the client", () => { + assert.strictEqual(typeof Template, "function"); + assert.ok(! _.has(Template, "lazy")); + require("./imports/lazy.html"); + assert.ok(_.has(Template, "lazy")); + assert.ok(Template.lazy instanceof Template); + }); + + Meteor.isServer && + it("should not be importable on the server", () => { + let error; + try { + require("./imports/lazy.html"); + } catch (expected) { + error = expected; + } + assert.ok(error instanceof Error); + }); +}); + describe("native node_modules", () => { Meteor.isServer && it("can be imported on the server", () => {