add tests for components and refactor test fixtures to not register all components as a side-effect

This commit is contained in:
Keegan
2016-02-11 15:43:12 -08:00
parent 9412908636
commit ba74959919
10 changed files with 143 additions and 61 deletions
+10 -1
View File
@@ -190,10 +190,18 @@ function ClayConfig(settings, config, $rootContainer) {
* @param {function} component.manipulator.get - get manipulator method
* @param {{}} component.defaults - template defaults
* @param {function} [component.initialize] - method to scaffold the component
* @return {void}
* @return {boolean} - Returns true if component was registered correctly
*/
ClayConfig.registerComponent = function(component) {
var _component = _.copyObj(component);
if (componentStore[_component.name]) {
console.warn('Component: ' + _component.name +
' is already registered. If you wish to override the existing' +
' functionality, you must provide a new name');
return false;
}
if (typeof _component.manipulator === 'string') {
_component.manipulator = manipulators[component.manipulator];
@@ -216,6 +224,7 @@ ClayConfig.registerComponent = function(component) {
}
componentStore[_component.name] = _component;
return true;
};
module.exports = ClayConfig;