mirror of
https://github.com/pebble-dev/clay.git
synced 2026-10-26 22:59:56 -04:00
restructure directories and add tests for clay-item
This commit is contained in:
1 parent
bca1975d8e
commit
c37012093a
23 files changed
+108
-38
No files matched your search
@@ -4,7 +4,7 @@ var HTML = require('../vendor/minified/minified').HTML;
|
||||
|
||||
module.exports = {
|
||||
name: 'color',
|
||||
template: require('../../templates/items/color.tpl'),
|
||||
template: require('../../templates/components/color.tpl'),
|
||||
manipulator: require('../lib/manipulators').val,
|
||||
defaults: {
|
||||
label: ''
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
module.exports = {
|
||||
name: 'footer',
|
||||
template: require('../../templates/items/footer.tpl'),
|
||||
template: require('../../templates/components/footer.tpl'),
|
||||
manipulator: require('../lib/manipulators').html,
|
||||
defaults: {
|
||||
attributes: {}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
module.exports = {
|
||||
name: 'heading',
|
||||
template: require('../../templates/items/heading.tpl'),
|
||||
template: require('../../templates/components/heading.tpl'),
|
||||
manipulator: require('../lib/manipulators').html,
|
||||
defaults: {
|
||||
attributes: {},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
module.exports = {
|
||||
name: 'input',
|
||||
template: require('../../templates/items/input.tpl'),
|
||||
template: require('../../templates/components/input.tpl'),
|
||||
manipulator: require('../lib/manipulators').val,
|
||||
defaults: {
|
||||
label: '',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
module.exports = {
|
||||
name: 'radiogroup',
|
||||
template: require('../../templates/items/radiogroup.tpl'),
|
||||
template: require('../../templates/components/radiogroup.tpl'),
|
||||
manipulator: require('../lib/manipulators').radiogroup,
|
||||
defaults: {
|
||||
label: '',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
module.exports = {
|
||||
name: 'select',
|
||||
template: require('../../templates/items/select.tpl'),
|
||||
template: require('../../templates/components/select.tpl'),
|
||||
manipulator: require('../lib/manipulators').val,
|
||||
defaults: {
|
||||
label: '',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
module.exports = {
|
||||
name: 'submit',
|
||||
template: require('../../templates/items/submit.tpl'),
|
||||
template: require('../../templates/components/submit.tpl'),
|
||||
manipulator: require('../lib/manipulators').val,
|
||||
defaults: {
|
||||
attributes: {}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
module.exports = {
|
||||
name: 'text',
|
||||
template: require('../../templates/items/text.tpl'),
|
||||
template: require('../../templates/components/text.tpl'),
|
||||
manipulator: require('../lib/manipulators').html,
|
||||
defaults: {
|
||||
attributes: {}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
module.exports = {
|
||||
name: 'toggle',
|
||||
template: require('../../templates/items/toggle.tpl'),
|
||||
template: require('../../templates/components/toggle.tpl'),
|
||||
manipulator: require('../lib/manipulators').checked,
|
||||
defaults: {
|
||||
attributes: {}
|
||||
|
||||
@@ -40,13 +40,13 @@ function ClayConfig(settings, config, $rootContainer) {
|
||||
self.EVENTS = {
|
||||
/**
|
||||
* Called before framework has initialized. This is when you would attach your
|
||||
* custom items.
|
||||
* custom components.
|
||||
* @const
|
||||
*/
|
||||
BEFORE_BUILD: 'BEFORE_BUILD',
|
||||
|
||||
/**
|
||||
* Called after the config has been parsed and all items have their initial value
|
||||
* Called after the config has been parsed and all components have their initial value
|
||||
* set
|
||||
* @const
|
||||
*/
|
||||
@@ -130,7 +130,7 @@ function ClayConfig(settings, config, $rootContainer) {
|
||||
$container.add($wrapper);
|
||||
_addItems(item.items, $wrapper);
|
||||
} else {
|
||||
var clayItem = new ClayItem(item);
|
||||
var clayItem = new ClayItem(item).initialize();
|
||||
|
||||
if (item.id) {
|
||||
_itemsById[item.id] = clayItem;
|
||||
|
||||
@@ -23,8 +23,8 @@ function ClayItem(config) {
|
||||
/** @type {string|null} */
|
||||
self.appKey = config.appKey || null;
|
||||
|
||||
/** @type {object|null} */
|
||||
self.config = config || null;
|
||||
/** @type {object} */
|
||||
self.config = config;
|
||||
|
||||
/** @type {M} */
|
||||
self.$element = HTML(_.formatHtml(_itemType.template, _templateData));
|
||||
@@ -38,7 +38,7 @@ function ClayItem(config) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the initializer. This will automatically be run on item creation.
|
||||
* Run the initializer if it exists.
|
||||
* @returns {ClayItem}
|
||||
*/
|
||||
self.initialize = function() {
|
||||
@@ -56,8 +56,6 @@ function ClayItem(config) {
|
||||
self[methodName] = method.bind(self);
|
||||
});
|
||||
|
||||
self.initialize();
|
||||
|
||||
// prevent external modifications of properties
|
||||
utils.updateProperties(self, { writable: false, configurable: false });
|
||||
}
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user