Change behavior of the toggle to return a boolean again

This commit is contained in:
Keegan
2016-03-07 13:13:36 +11:00
parent de00ac1fd6
commit d63c6c832d
3 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -480,7 +480,7 @@ Many of these methods fire an event when the method is called. You can listen fo
| Method | Returns | Event Fired | Description | | Method | Returns | Event Fired | Description |
|--------|---------|-------------| ------------| |--------|---------|-------------| ------------|
| `.set( [boolean\|int] value)` | `ClayItem` | `change` | Check/uncheck the state of this item. | | `.set( [boolean\|int] value)` | `ClayItem` | `change` | Check/uncheck the state of this item. |
| `.get()` | `int` | | 1 if checked, 0 if not checked | | `.get()` | `boolean` | | `true` if checked, `false` if not. **NOTE** this will be converted to a `1` or `0` when sent to the watch. See [`ClayConfig.getSettings()`](#methods-1) |
| `.disable()` | `ClayItem` | `disabled` | Prevents this item from being edited by the user. | | `.disable()` | `ClayItem` | `disabled` | Prevents this item from being edited by the user. |
| `.enable()` | `ClayItem` | `enabled` | Allows this item to be edited by the user. | | `.enable()` | `ClayItem` | `enabled` | Allows this item to be edited by the user. |
| `.hide()` | `ClayItem` | `hide` | Hides the item | | `.hide()` | `ClayItem` | `hide` | Hides the item |
@@ -513,7 +513,7 @@ Many of these methods fire an event when the method is called. You can listen fo
| Method | Returns | Event Fired | Description | | Method | Returns | Event Fired | Description |
|--------|---------|-------------| ------------| |--------|---------|-------------| ------------|
| `.set( [array] value)` | `ClayItem` | `change` | Checks the checkboxes that corresponds to the provided list of values. | | `.set( [array] value)` | `ClayItem` | `change` | Checks the checkboxes that corresponds to the provided list of values. |
| `.get()` | `Array.<string>` | | Gets an array of strings representing the list of the values of the checked items | | `.get()` | `Array.<string>` | | Gets an array of strings representing the list of the values of the checked items. **NOTE:** each item in the array will be separated by a zero when sent to the watch. See [`ClayConfig.getSettings()`](#methods-1) |
| `.disable()` | `ClayItem` | `disabled` | Prevents this item from being edited by the user. | | `.disable()` | `ClayItem` | `disabled` | Prevents this item from being edited by the user. |
| `.enable()` | `ClayItem` | `enabled` | Allows this item to be edited by the user. | | `.enable()` | `ClayItem` | `enabled` | Allows this item to be edited by the user. |
| `.hide()` | `ClayItem` | `hide` | Hides the item | | `.hide()` | `ClayItem` | `hide` | Hides the item |
+1 -1
View File
@@ -61,7 +61,7 @@ module.exports = {
}, },
checked: { checked: {
get: function() { get: function() {
return this.$manipulatorTarget.get('checked') ? 1 : 0; return this.$manipulatorTarget.get('checked');
}, },
set: function(value) { set: function(value) {
this.$manipulatorTarget.set('checked', !!value); this.$manipulatorTarget.set('checked', !!value);
+4 -4
View File
@@ -152,10 +152,10 @@ describe('manipulators', function() {
}); });
describe('checked', function() { describe('checked', function() {
testSetGet('toggle', true, 1); testSetGet('toggle', true);
testSetGet('toggle', 1); testSetGet('toggle', 1, true);
testSetGet('toggle', false, 0); testSetGet('toggle', false);
testSetGet('toggle', 0); testSetGet('toggle', 0, false);
testDisable('toggle'); testDisable('toggle');
testEnable('toggle'); testEnable('toggle');
testShow('toggle'); testShow('toggle');