Skip to content

Commit

Permalink
[Advanced settings] Reset to default for empty strings (#85137) (#85516)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
stratoula and kibanamachine authored Dec 10, 2020
1 parent f5ae464 commit 71990e2
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 71990e2

Please sign in to comment.