Skip to content

Commit

Permalink
lens suffix formatter fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Dosant committed Jul 29, 2021
1 parent 41f25a7 commit 39c16f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions x-pack/plugins/lens/common/suffix_formatter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const unitSuffixesLong: Record<TimeScaleUnit, string> = {
export function getSuffixFormatter(formatFactory: FormatFactory): FieldFormatInstanceType {
return class SuffixFormatter extends FieldFormat {
static id = 'suffix';
static hidden = true; // Don't want this format to appear in index pattern editor
static title = i18n.translate('xpack.lens.fieldFormats.suffix.title', {
defaultMessage: 'Suffix',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,11 @@ describe('suffix formatter', () => {

expect(result).toEqual('');
});

it('should be a hidden formatter', () => {
const convertMock = jest.fn((x) => '');
const formatFactory = jest.fn(() => ({ convert: convertMock }));
const SuffixFormatter = getSuffixFormatter((formatFactory as unknown) as FormatFactory);
expect(SuffixFormatter.hidden).toBe(true);
});
});

0 comments on commit 39c16f7

Please sign in to comment.