diff --git a/src/plugins/field_formats/common/converters/url.test.ts b/src/plugins/field_formats/common/converters/url.test.ts index d1c89575b2d4d..9a1fcb7cbef6e 100644 --- a/src/plugins/field_formats/common/converters/url.test.ts +++ b/src/plugins/field_formats/common/converters/url.test.ts @@ -139,7 +139,7 @@ describe('UrlFormat', () => { expect(url.convert('url', TEXT_CONTEXT_TYPE)).toBe('external url'); }); - test('can use the raw value', () => { + test('can use the raw value with {{value}}', () => { const url = new UrlFormat({ labelTemplate: 'external {{value}}', }); @@ -147,6 +147,14 @@ describe('UrlFormat', () => { expect(url.convert('url?', TEXT_CONTEXT_TYPE)).toBe('external url?'); }); + test('can use the raw value with {{rawValue}}', () => { + const url = new UrlFormat({ + labelTemplate: 'external {{rawValue}}', + }); + + expect(url.convert('url?', TEXT_CONTEXT_TYPE)).toBe('external url?'); + }); + test('can use the url', () => { const url = new UrlFormat({ urlTemplate: 'http://google.com/{{value}}', diff --git a/src/plugins/field_formats/common/converters/url.ts b/src/plugins/field_formats/common/converters/url.ts index a0b423a737f08..ffa6973de27a4 100644 --- a/src/plugins/field_formats/common/converters/url.ts +++ b/src/plugins/field_formats/common/converters/url.ts @@ -86,6 +86,7 @@ export class UrlFormat extends FieldFormat { return this.compileTemplate(template)({ value, url, + rawValue: value, }); }