diff --git a/js/bootstrap-colorpicker-module.js b/js/bootstrap-colorpicker-module.js index 846c323..3471c53 100644 --- a/js/bootstrap-colorpicker-module.js +++ b/js/bootstrap-colorpicker-module.js @@ -268,10 +268,10 @@ angular.module('colorpicker.module', []) var thisFormat = attrs.colorpicker ? attrs.colorpicker : 'hex', position = angular.isDefined(attrs.colorpickerPosition) ? attrs.colorpickerPosition : 'bottom', - inline = angular.isDefined(attrs.colorpickerInline) ? attrs.colorpickerInline : false, - fixedPosition = angular.isDefined(attrs.colorpickerFixedPosition) ? attrs.colorpickerFixedPosition : false, + inline = angular.isDefined(attrs.colorpickerInline) ? JSON.parse(attrs.colorpickerInline) : false, + fixedPosition = angular.isDefined(attrs.colorpickerFixedPosition) ? JSON.parse(attrs.colorpickerFixedPosition) : false, target = angular.isDefined(attrs.colorpickerParent) ? elem.parent() : angular.element(document.body), - withInput = angular.isDefined(attrs.colorpickerWithInput) ? attrs.colorpickerWithInput : false, + withInput = angular.isDefined(attrs.colorpickerWithInput) ? JSON.parse(attrs.colorpickerWithInput) : false, componentSize = angular.isDefined(attrs.colorpickerSize) ? attrs.colorpickerSize : 100, componentSizePx = componentSize + 'px', inputTemplate = withInput ? '' : '', diff --git a/test/unit/colorpickerSpec.js b/test/unit/colorpickerSpec.js index 270fc33..1045199 100644 --- a/test/unit/colorpickerSpec.js +++ b/test/unit/colorpickerSpec.js @@ -100,6 +100,14 @@ describe('colorpicker module', function () { elm.trigger('keyup'); expect($colorPickerInput.val()).toBe('#333'); }); + + it('should not show the optional input field, when colorpicker-with-input="false"', function() { + var elem = compileElement('', $scope); + elem.click(); + var $colorPicker = $('.colorpicker:last'); + var $colorPickerInput = $colorPicker.find('input'); + expect($colorPickerInput.size()).toBe(0); + }); }); describe('Color', function () {