mirror of
https://github.com/pebble-dev/clay.git
synced 2026-08-28 12:56:34 -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
|
||||
ClayEvents.call(self, self.$element);
|
||||
ClayEvents.call(self, self.$manipulatorTarget);
|
||||
|
||||
// attach the manipulator methods to the clayItem
|
||||
_.eachObj(_component.manipulator, function(methodName, method) {
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
type="checkbox"
|
||||
value="{{this.value}}"
|
||||
name="clay-{{clayId}}"
|
||||
data-manipulator-target
|
||||
{{each key: attributes}}{{key}}="{{this}}"{{/each}}
|
||||
/>
|
||||
<i></i>
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
type="radio"
|
||||
value="{{this.value}}"
|
||||
name="clay-{{clayId}}"
|
||||
data-manipulator-target
|
||||
{{each key: attributes}}{{key}}="{{this}}"{{/each}}
|
||||
/>
|
||||
<i></i>
|
||||
|
||||
@@ -7,6 +7,7 @@ var HTML = require('../../../src/scripts/vendor/minified').HTML;
|
||||
var components = require('../../../src/scripts/components');
|
||||
var manipulators = require('../../../src/scripts/lib/manipulators');
|
||||
var fixture = require('../../fixture');
|
||||
var sinon = require('sinon');
|
||||
|
||||
var componentSchema = Joi.object().keys({
|
||||
name: Joi.string().required(),
|
||||
@@ -39,6 +40,20 @@ describe('components', function() {
|
||||
it('is able to be passed to ClayConfig', function() {
|
||||
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