diff --git a/polygerrit-ui/app/elements/shared/gr-linked-text/gr-linked-text_test.html b/polygerrit-ui/app/elements/shared/gr-linked-text/gr-linked-text_test.html index c7d5a4b97590..f9b663cb36b0 100644 --- a/polygerrit-ui/app/elements/shared/gr-linked-text/gr-linked-text_test.html +++ b/polygerrit-ui/app/elements/shared/gr-linked-text/gr-linked-text_test.html @@ -65,6 +65,10 @@ match: 'hash:(.+)', html: '$1', }, + baseurl: { + match: 'test (.+)', + html: '$1', + }, disabledconfig: { match: 'foo:(.+)', link: 'https://google.com/search?q=$1', @@ -202,6 +206,15 @@ test('html with base url', function() { window.CANONICAL_PATH = '/r'; + element.content = 'test foo'; + const linkEl = element.$.output.childNodes[0]; + assert.isTrue(linkEl.href.endsWith('/r/awesomesauce')); + assert.equal(linkEl.textContent, 'foo'); + }); + + test('hash html with base url', function() { + window.CANONICAL_PATH = '/r'; + element.content = 'hash:foo'; const linkEl = element.$.output.childNodes[0]; assert.isTrue(linkEl.href.endsWith('/r/awesomesauce')); diff --git a/polygerrit-ui/app/elements/shared/gr-linked-text/link-text-parser.js b/polygerrit-ui/app/elements/shared/gr-linked-text/link-text-parser.js index 29c0a400f8e5..1afcc30fd448 100644 --- a/polygerrit-ui/app/elements/shared/gr-linked-text/link-text-parser.js +++ b/polygerrit-ui/app/elements/shared/gr-linked-text/link-text-parser.js @@ -109,7 +109,7 @@ GrLinkTextParser.prototype.addHTML = function(html, position, length, outputArray) { if (!this.hasOverlap(position, length, outputArray)) { if (!!this.baseUrl && html.match(/