Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/enyojs/enyo
Browse files Browse the repository at this point in the history
  • Loading branch information
vtomilin committed Sep 4, 2012
2 parents 5e1bef8 + 0779a39 commit 86a911e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
5 changes: 4 additions & 1 deletion source/kernel/Component.js
Expand Up @@ -230,6 +230,9 @@ enyo.kind({
inProps.owner = inProps.owner || this;
},
_createComponent: function(inInfo, inMoreInfo) {
if (!inInfo.kind && ("kind" in inInfo)) {
throw "enyo.create: Attempt to create a null kind. Check dependencies for [" + inInfo.name + "].";
}
// CAVEAT: inInfo and inMoreInfo are copied before mutation, but it's only a shallow copy
var props = enyo.mixin(enyo.clone(inMoreInfo), inInfo);
this.adjustComponentProps(props);
Expand Down Expand Up @@ -442,7 +445,7 @@ enyo.defaultCtor = enyo.Component;

enyo.create = enyo.Component.create = function(inConfig) {
if (!inConfig.kind && ("kind" in inConfig)) {
throw "enyo.create: Attempt to create a null kind. Check dependencies.";
throw "enyo.create: Attempt to create a null kind. Check dependencies for [" + (inConfig.name || "") + "].";
}
var kind = inConfig.kind || inConfig.isa || enyo.defaultCtor;
var ctor = enyo.constructorForKind(kind);
Expand Down
28 changes: 28 additions & 0 deletions tools/test/core/tests/ComponentTest.js
@@ -0,0 +1,28 @@
enyo.kind({
name: "ComponentTest",
kind: enyo.TestSuite,
testNestedComponentUndefinedKind: function() {
var pass = false;
// should throw exception as this is an error
try {
var a = enyo.kind(
{
name: "parentComponent",
components: [
{
name: "nestedComponent",
kind: undefined
}
]
}
);
new a({});
} catch(e) {
pass = true;
}
if (!pass) {
throw("no exception for explicitly undefined kind in a nested component");
}
this.finish();
}
});
1 change: 1 addition & 0 deletions tools/test/core/tests/package.js
Expand Up @@ -4,6 +4,7 @@ enyo.depends(
"JsonTest.js",
"AsyncTest.js",
"AjaxTest.js",
"ComponentTest.js",
"ComponentDispatchTest.js",
"ComponentHandlersTest.js",
"ControlPropsTest.js",
Expand Down

0 comments on commit 86a911e

Please sign in to comment.