diff --git a/api/tests/test-mount.js b/api/tests/test-mount.js index 210a0627..038f470a 100644 --- a/api/tests/test-mount.js +++ b/api/tests/test-mount.js @@ -32,7 +32,17 @@ o.spec("mount", function() { o(threw).equals(true) }) - o("renders into `root`", function() { + o("throws on invalid component", function() { + var threw = false + try { + mount(root, {}) + } catch (e) { + threw = true + } + o(threw).equals(true) + }) + + o("renders into `root` (POJO component)", function() { mount(root, { view : function() { return m("div") @@ -42,6 +52,26 @@ o.spec("mount", function() { o(root.firstChild.nodeName).equals("DIV") }) + o("renders into `root` (class component)", function() { + function Cmp(){} + Cmp.prototype.view = function(){return m("div")} + mount(root, Cmp) + + o(root.firstChild.nodeName).equals("DIV") + }) + + o("renders into `root` factory (factory component)", function() { + mount(root, function(){ + return { + view : function() { + return m("div") + } + } + }) + + o(root.firstChild.nodeName).equals("DIV") + }) + o("mounting null unmounts", function() { mount(root, { view : function() {