From fa3406a809c312e439179826b33ecfbbaf6530d1 Mon Sep 17 00:00:00 2001 From: Keegan Lillo Date: Fri, 21 Oct 2016 12:11:12 -0700 Subject: [PATCH] #151 - Fix incorrect value being set when `defaultValue` is falsey (#152) --- dev/config.js | 6 +++--- src/scripts/lib/clay-config.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dev/config.js b/dev/config.js index c98ef72..0499478 100644 --- a/dev/config.js +++ b/dev/config.js @@ -64,11 +64,11 @@ module.exports = [ { "type": "slider", "messageKey": "slider", - "defaultValue": 15, + "defaultValue": 0, "label": "Slider", "description": "This is the description for the slider", - "min": 10, - "max": 20, + "min": 0, + "max": 30, "step": 0.25 }, { diff --git a/src/scripts/lib/clay-config.js b/src/scripts/lib/clay-config.js index 743f40c..0a31610 100644 --- a/src/scripts/lib/clay-config.js +++ b/src/scripts/lib/clay-config.js @@ -86,9 +86,9 @@ function ClayConfig(settings, config, $rootContainer, meta) { // set the value of the item via the manipulator to ensure consistency var value = typeof _settings[_item.messageKey] !== 'undefined' ? _settings[_item.messageKey] : - (_item.defaultValue || ''); + _item.defaultValue; - clayItem.set(value); + clayItem.set(typeof value !== 'undefined' ? value : ''); $container.add(clayItem.$element); }