mirror of
https://github.com/pebble-dev/clay.git
synced 2026-09-03 07:37:46 -04:00
Merge remote-tracking branch 'origin/master' into #20/allow-user-data
This commit is contained in:
@@ -59,7 +59,7 @@ function ClayItem(config) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// attach event methods
|
// attach event methods
|
||||||
ClayEvents.call(self, self.$element);
|
ClayEvents.call(self, self.$manipulatorTarget);
|
||||||
|
|
||||||
// attach the manipulator methods to the clayItem
|
// attach the manipulator methods to the clayItem
|
||||||
_.eachObj(_component.manipulator, function(methodName, method) {
|
_.eachObj(_component.manipulator, function(methodName, method) {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
type="checkbox"
|
type="checkbox"
|
||||||
value="{{this.value}}"
|
value="{{this.value}}"
|
||||||
name="clay-{{clayId}}"
|
name="clay-{{clayId}}"
|
||||||
data-manipulator-target
|
|
||||||
{{each key: attributes}}{{key}}="{{this}}"{{/each}}
|
{{each key: attributes}}{{key}}="{{this}}"{{/each}}
|
||||||
/>
|
/>
|
||||||
<i></i>
|
<i></i>
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
type="radio"
|
type="radio"
|
||||||
value="{{this.value}}"
|
value="{{this.value}}"
|
||||||
name="clay-{{clayId}}"
|
name="clay-{{clayId}}"
|
||||||
data-manipulator-target
|
|
||||||
{{each key: attributes}}{{key}}="{{this}}"{{/each}}
|
{{each key: attributes}}{{key}}="{{this}}"{{/each}}
|
||||||
/>
|
/>
|
||||||
<i></i>
|
<i></i>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ var HTML = require('../../../src/scripts/vendor/minified').HTML;
|
|||||||
var components = require('../../../src/scripts/components');
|
var components = require('../../../src/scripts/components');
|
||||||
var manipulators = require('../../../src/scripts/lib/manipulators');
|
var manipulators = require('../../../src/scripts/lib/manipulators');
|
||||||
var fixture = require('../../fixture');
|
var fixture = require('../../fixture');
|
||||||
|
var sinon = require('sinon');
|
||||||
|
|
||||||
var componentSchema = Joi.object().keys({
|
var componentSchema = Joi.object().keys({
|
||||||
name: Joi.string().required(),
|
name: Joi.string().required(),
|
||||||
@@ -39,6 +40,20 @@ describe('components', function() {
|
|||||||
it('is able to be passed to ClayConfig', function() {
|
it('is able to be passed to ClayConfig', function() {
|
||||||
fixture.clayConfig([component.name]);
|
fixture.clayConfig([component.name]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('only has one $manipulatorTarget', function() {
|
||||||
|
var configItem = fixture.clayConfig([component.name]).getAllItems()[0];
|
||||||
|
assert.strictEqual(configItem.$manipulatorTarget.length, 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('only dispatches change events once', function() {
|
||||||
|
var configItem = fixture.clayConfig([component.name]).getAllItems()[0];
|
||||||
|
var handler = sinon.spy();
|
||||||
|
configItem.on('change', handler);
|
||||||
|
configItem.trigger('change');
|
||||||
|
assert.strictEqual(handler.callCount, 1);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user