Skip to content

Commit

Permalink
Remove default from byte formatting component
Browse files Browse the repository at this point in the history
If the user has deleted this default, they presumably meant to do so and
we shouldn't supersede it.
  • Loading branch information
rylnd committed Jan 7, 2020
1 parent afd5f17 commit 215f59c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ describe('PreferenceFormattedBytes', () => {
expect(toJson(wrapper)).toMatchSnapshot();
});

test('it renders bytes to hardcoded format when no configuration exists', () => {
test('it renders bytes to Numeral formatting when no format setting exists', () => {
mockUseUiSetting$.mockImplementation(() => [null]);
const wrapper = mount(<PreferenceFormattedBytesComponent value={bytes} />);

expect(wrapper.text()).toEqual('2.7MB');
expect(wrapper.text()).toEqual('2,806,422');
});

test('it renders bytes according to the default format', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useUiSetting$ } from '../../lib/kibana';

export const PreferenceFormattedBytesComponent = ({ value }: { value: string | number }) => {
const [bytesFormat] = useUiSetting$<string>(DEFAULT_BYTES_FORMAT);
return <>{numeral(value).format(bytesFormat || '0,0.[0]b')}</>;
return <>{numeral(value).format(bytesFormat)}</>;
};

PreferenceFormattedBytesComponent.displayName = 'PreferenceFormattedBytesComponent';
Expand Down

0 comments on commit 215f59c

Please sign in to comment.