diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2018-08-06 08:34:00 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-06 08:34:00 +0300 |
commit | 89210df0ec01e4c6b2eb9f2c01854be52adbfce6 (patch) | |
tree | 9e25acd2b6c534aea399e67797aec87b6c008658 /plugins/CorePluginsAdmin | |
parent | 70ca09f0af2decc812e76fd7826c7496a4d42697 (diff) |
Fixing regressions causing UI tests to fail (#13252)
* Request.initAuthenticationObject is not always called now so use different event.
* default value for form field may not be JSON.
* Add date parameter as default value in ajaxHelper in case it is needed.
* update screenshot
* Update screenshot.
* Do not show default value when it is an array and only contains undefined values.
Diffstat (limited to 'plugins/CorePluginsAdmin')
-rw-r--r-- | plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js b/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js index ff4419d4fd..6774fda081 100644 --- a/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js +++ b/plugins/CorePluginsAdmin/angularjs/form-field/form-field.directive.js @@ -281,7 +281,13 @@ function formatPrettyDefaultValue(defaultValue, availableOptions) { if (angular.isString(defaultValue) && defaultValue) { // eg default value for multi tuple - var defaultParsed = JSON.parse(defaultValue); + var defaultParsed = null; + try { + defaultParsed = JSON.parse(defaultValue); + } catch (e) { + // invalid JSON + } + if (angular.isObject(defaultParsed)) { return null; } @@ -302,7 +308,7 @@ } angular.forEach(availableOptions, function (value, key) { - if (defaultValue.indexOf(value.key) !== -1) { + if (defaultValue.indexOf(value.key) !== -1 && typeof value.value !== 'undefined') { prettyValues.push(value.value); } }); |