Merge remote-tracking branch 'origin/master' into #20/allow-user-data

This commit is contained in:
Keegan
2016-03-12 10:16:47 +11:00
4 changed files with 16 additions and 3 deletions
+1 -1
View File
@@ -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>
-1
View File
@@ -8,7 +8,6 @@
type="radio"
value="{{this.value}}"
name="clay-{{clayId}}"
data-manipulator-target
{{each key: attributes}}{{key}}="{{this}}"{{/each}}
/>
<i></i>
+15
View File
@@ -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);
});
});
});
});