Refactor structure to be more testable

This commit is contained in:
Keegan
2016-01-27 00:03:07 -08:00
parent b960dc19f4
commit 13b84f7e6c
19 changed files with 391 additions and 3095 deletions
+4 -4
View File
@@ -22,7 +22,7 @@ module.exports = [
},
{
"type": "input",
"app_key": "email",
"appKey": "email",
"value": "",
"label": "Email",
"attributes": {
@@ -34,13 +34,13 @@ module.exports = [
},
{
"type": "toggle",
"app_key": "like_stuff",
"appKey": "cool_stuff",
"label": "Enable Cool Stuff",
"value": false
},
{
"type": "color",
"app_key": "background",
"appKey": "background",
"value": "0xFF0000",
"label": "Background Color"
}
@@ -56,7 +56,7 @@ module.exports = [
{
"id": "flavor",
"type": "select",
"app_key": "flavor",
"appKey": "flavor",
"value": "grape",
"label": "Favorite Flavor",
"options": [
+9 -9
View File
@@ -1,15 +1,15 @@
'use strict';
module.exports = function() {
var Api = window.Clay = this;
var Clay = this;
var testHandler = function() {
console.debug('KEEGAN: this', this);
console.debug('KEEGAN: arguments', arguments);
// Api.getItemByAppKey('background').off(testHandler);
};
Clay.getItemByAppKey('cool_stuff').on('change', function() {
if (this.get()) {
Clay.getItemByAppKey('background').enable();
} else {
Clay.getItemByAppKey('background').disable();
}
});
Api.getItemByAppKey('background').on('change', testHandler);
console.debug('custom fn worked');
Clay.getSettings();
};