mirror of
https://github.com/pebble-dev/clay.git
synced 2026-08-28 04:46:57 -04:00
Change behavior of the toggle to return a boolean again
This commit is contained in:
@@ -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 |
|
||||
|--------|---------|-------------| ------------|
|
||||
| `.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. |
|
||||
| `.enable()` | `ClayItem` | `enabled` | Allows this item to be edited by the user. |
|
||||
| `.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 |
|
||||
|--------|---------|-------------| ------------|
|
||||
| `.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. |
|
||||
| `.enable()` | `ClayItem` | `enabled` | Allows this item to be edited by the user. |
|
||||
| `.hide()` | `ClayItem` | `hide` | Hides the item |
|
||||
|
||||
@@ -61,7 +61,7 @@ module.exports = {
|
||||
},
|
||||
checked: {
|
||||
get: function() {
|
||||
return this.$manipulatorTarget.get('checked') ? 1 : 0;
|
||||
return this.$manipulatorTarget.get('checked');
|
||||
},
|
||||
set: function(value) {
|
||||
this.$manipulatorTarget.set('checked', !!value);
|
||||
|
||||
@@ -152,10 +152,10 @@ describe('manipulators', function() {
|
||||
});
|
||||
|
||||
describe('checked', function() {
|
||||
testSetGet('toggle', true, 1);
|
||||
testSetGet('toggle', 1);
|
||||
testSetGet('toggle', false, 0);
|
||||
testSetGet('toggle', 0);
|
||||
testSetGet('toggle', true);
|
||||
testSetGet('toggle', 1, true);
|
||||
testSetGet('toggle', false);
|
||||
testSetGet('toggle', 0, false);
|
||||
testDisable('toggle');
|
||||
testEnable('toggle');
|
||||
testShow('toggle');
|
||||
|
||||
Reference in New Issue
Block a user