#3993 Move color picker fix to correct method and update backwards compatibility test

This commit is contained in:
Sebastiaan Janssen
2019-01-10 15:35:48 +01:00
parent d2baf03119
commit d69f0fe9dd

View File

@@ -123,11 +123,6 @@ function ColorPickerController($scope) {
if (!$scope.model.value)
return false;
// Backwards compatibility, the color used to be stored as a hex value only
if ($scope.model.value.length === 6) {
$scope.model.value = { value: $scope.model.value, label: $scope.model.value };
}
// Complex color (value and label)?
if (!$scope.model.value.hasOwnProperty("value"))
return $scope.model.value === color.value;
@@ -144,6 +139,11 @@ function ColorPickerController($scope) {
if (!$scope.model.value)
return;
// Backwards compatibility, the color used to be stored as a hex value only
if (typeof $scope.model.value === "string") {
$scope.model.value = { value: $scope.model.value, label: $scope.model.value };
}
// Complex color (value and label)?
if (!$scope.model.value.hasOwnProperty("value"))
return;