diff --git a/app/common/lib/siteSuggestions.js b/app/common/lib/siteSuggestions.js index e2c40e21255..229d1bb4841 100644 --- a/app/common/lib/siteSuggestions.js +++ b/app/common/lib/siteSuggestions.js @@ -61,8 +61,11 @@ const tokenizeInput = (data) => { return [] } url = data.location + if (data.customTitle) { + parts = getPartsFromNonUrlInput(data.customTitle) + } if (data.title) { - parts = getPartsFromNonUrlInput(data.title) + parts = parts.concat(getPartsFromNonUrlInput(data.title)) } if (data.tags) { parts = parts.concat(data.tags.map(getTagToken)) diff --git a/test/unit/app/common/lib/siteSuggestionsTest.js b/test/unit/app/common/lib/siteSuggestionsTest.js index 9f6d521f4c7..261eb7432d1 100644 --- a/test/unit/app/common/lib/siteSuggestionsTest.js +++ b/test/unit/app/common/lib/siteSuggestionsTest.js @@ -21,7 +21,8 @@ const site3 = { const site4 = { location: 'https://www.designers.com/brad', title: 'Brad Saves The World!', - count: 50 + count: 50, + customTitle: 'brad-heart-composite' } // Same as site4 but added after in init, should be ignored. @@ -149,6 +150,9 @@ describe('siteSuggestions lib', function () { it('can query on title', function (cb) { checkResult('back', [site2], cb) }) + it('can query on customTitle', function (cb) { + checkResult('heart-comp', [site4], cb) + }) it('can query on multiple tokens in different order', function (cb) { checkResult('back really', [site2], cb) }) @@ -337,11 +341,13 @@ describe('siteSuggestions lib', function () { checkResult('slack', [{ location: 'https://slack.com' }], cb) }) it('adding twice results in 1 result only with latest results', function (cb) { - add({ + const newSite = { location: 'https://slack.com', - count: 30 - }) - checkResult('slack', [{ location: 'https://slack.com', count: 30 }], cb) + count: 30, + customTitle: 'SlickSlack' + } + add(newSite) + checkResult('slack', [newSite], cb) }) it('can add simple strings', function (cb) { add({