Skip to content

Commit

Permalink
[Advanced settings] Reset to default for empty strings (elastic#85137)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
stratoula and kibanamachine committed Dec 10, 2020
1 parent f94e564 commit 680c23a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ describe('Settings', function () {
});

describe('without a value', function () {
it('should return true', function () {
it('should return false for empty string but true for undefined', function () {
expect(isDefaultValue({ ...setting, value: undefined })).to.be(true);
expect(isDefaultValue({ ...setting, value: '' })).to.be(true);
expect(isDefaultValue({ ...setting, value: '' })).to.be(false);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export function isDefaultValue(setting: FieldSetting) {
return (
setting.isCustom ||
setting.value === undefined ||
setting.value === '' ||
String(setting.value) === String(setting.defVal)
);
}

0 comments on commit 680c23a

Please sign in to comment.