diff options
| author | Phil Crosby | 2012-06-03 01:22:25 -0700 |
|---|---|---|
| committer | Phil Crosby | 2012-06-03 16:56:39 -0700 |
| commit | 4a90ae22b2e0de76d0993e4158a6232e7de1c108 (patch) | |
| tree | bfc78b15d60ea1324aab449a82734734cdb62060 | |
| parent | a8e46be20fa8070f7975381efc22c5a72880da6c (diff) | |
| download | vimium-4a90ae22b2e0de76d0993e4158a6232e7de1c108.tar.bz2 | |
Rank results in the correct order.
| -rw-r--r-- | background_scripts/completion.coffee | 2 | ||||
| -rw-r--r-- | tests/completion_test.coffee | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index 41ebeab8..f1016ebb 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -138,7 +138,7 @@ class MultiCompleter sortSuggestions: (suggestions) -> for suggestion in suggestions suggestion.computeRelevancy(@queryTerms) - suggestions.sort (a, b) -> a.relevancy - b.relevancy + suggestions.sort (a, b) -> b.relevancy - a.relevancy suggestions RankingUtils = diff --git a/tests/completion_test.coffee b/tests/completion_test.coffee index ed56d0e9..813d3af3 100644 --- a/tests/completion_test.coffee +++ b/tests/completion_test.coffee @@ -47,15 +47,15 @@ context "history completer", context "suggestions", should "escape html in page titles", -> - suggestion = new Suggestion(["queryterm"], "tab", "url", "title <span>") + suggestion = new Suggestion(["queryterm"], "tab", "url", "title <span>", returns(1)) assert.isTrue suggestion.generateHtml().indexOf("title <span>") >= 0 should "highlight query words", -> - suggestion = new Suggestion(["ninja"], "tab", "url", "ninjawords") + suggestion = new Suggestion(["ninja"], "tab", "url", "ninjawords", returns(1)) assert.isTrue suggestion.generateHtml().indexOf("<span class='match'>ninja</span>words") >= 0 should "shorten urls", -> - suggestion = new Suggestion(["queryterm"], "tab", "http://ninjawords.com", "ninjawords") + suggestion = new Suggestion(["queryterm"], "tab", "http://ninjawords.com", "ninjawords", returns(1)) assert.equal -1, suggestion.generateHtml().indexOf("http://ninjawords.com") hours = (n) -> 1000 * 60 * 60 * n |
