mirror of
https://github.com/pebble-dev/clay.git
synced 2026-09-01 06:46:49 -04:00
Automatically handle the "showConfiguration" and "webviewclosed" events + other minor code cleanup
This commit is contained in:
+5
-5
@@ -10,7 +10,7 @@ var componentRegistry = require('../src/scripts/lib/component-registry');
|
||||
var idCounter = 0;
|
||||
|
||||
/**
|
||||
* @param {string|{}} config
|
||||
* @param {string|Object} config
|
||||
* @param {boolean} [autoRegister=true]
|
||||
* @returns {Clay~ConfigItem}
|
||||
*/
|
||||
@@ -37,7 +37,7 @@ module.exports.configItem = function(config, autoRegister) {
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string|{}} config
|
||||
* @param {string|Object} config
|
||||
* @param {boolean} [autoRegister=true]
|
||||
* @returns {ClayItem}
|
||||
*/
|
||||
@@ -46,7 +46,7 @@ module.exports.clayItem = function(config, autoRegister) {
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {[]} types
|
||||
* @param {Array} types
|
||||
* @param {boolean} [autoRegister=true]
|
||||
* @returns {*}
|
||||
*/
|
||||
@@ -59,10 +59,10 @@ module.exports.config = function(types, autoRegister) {
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {[]} types
|
||||
* @param {Array} types
|
||||
* @param {boolean} [build=true] - run the build method on the result
|
||||
* @param {boolean} [autoRegister=true]
|
||||
* @param {{}} [settings] - settings to pass to constructor
|
||||
* @param {Object} [settings] - settings to pass to constructor
|
||||
* @returns {ClayConfig}
|
||||
*/
|
||||
module.exports.clayConfig = function(types, build, autoRegister, settings) {
|
||||
|
||||
@@ -181,6 +181,23 @@ describe('ClayConfig', function() {
|
||||
clayConfig.build();
|
||||
});
|
||||
|
||||
it('throws if there is no manipulator',
|
||||
function(done) {
|
||||
delete componentRegistry.select;
|
||||
var clayConfig = fixtures.clayConfig(['select'], false, false);
|
||||
var _selectComponent = _.copyObj(selectComponent);
|
||||
_selectComponent.manipulator = undefined;
|
||||
|
||||
clayConfig.on(clayConfig.EVENTS.BEFORE_BUILD, function() {
|
||||
assert.throws(function() {
|
||||
clayConfig.registerComponent(_selectComponent);
|
||||
}, /manipulator must be defined/);
|
||||
done();
|
||||
});
|
||||
|
||||
clayConfig.build();
|
||||
});
|
||||
|
||||
it('only registers the component once', function() {
|
||||
delete componentRegistry.select;
|
||||
var warnStub = sinon.stub(console, 'warn');
|
||||
|
||||
Reference in New Issue
Block a user