FIX: not doing non leading word match in emoji autocomplete

This commit is contained in:
Sam 2016-07-04 19:16:08 +10:00
parent ff37685aef
commit c665607f72
2 changed files with 4 additions and 1 deletions

View file

@ -254,7 +254,7 @@ Discourse.Emoji.search = function(term, options) {
for (i=0; i<toSearch.length; i++) {
item = toSearch[i];
if (item.indexOf(term) === 0 && addResult(item)) {
if (item.indexOf(term) > 0 && addResult(item)) {
return results;
}
}

View file

@ -28,4 +28,7 @@ test("Emoji.search", function(){
// able to find an alias
equal(Discourse.Emoji.search("+1").length, 1);
// able to find middle of line search
equal(Discourse.Emoji.search("check", {maxResults: 3}).length, 3);
});