diff options
| author | Stephen Blott | 2012-11-13 22:18:06 +0000 |
|---|---|---|
| committer | Stephen Blott | 2012-11-13 22:18:06 +0000 |
| commit | 4dc517401a2d01d34455498ff805e81f7f4f2674 (patch) | |
| tree | 93926e867a8db947262c8a9cb795ff9391c27dc2 /tests | |
| parent | 85bffd2dd8ef75b7c50d6851350490aea4c184cd (diff) | |
| download | vimium-4dc517401a2d01d34455498ff805e81f7f4f2674.tar.bz2 | |
Smartcase matching for vomnibar.
Vomnibar queries are case insensitive, unless the query contains a capital letter.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unit_tests/completion_test.coffee | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/unit_tests/completion_test.coffee b/tests/unit_tests/completion_test.coffee index 08ce46c2..8b6ba3ea 100644 --- a/tests/unit_tests/completion_test.coffee +++ b/tests/unit_tests/completion_test.coffee @@ -258,16 +258,24 @@ context "suggestions", context "RankingUtils", should "do a case insensitive match", -> - assert.isTrue RankingUtils.matches(["aRi"], "MARIO", "MARio") + assert.isTrue RankingUtils.matches(["ari"], "maRio", "mario") should "do a case insensitive match on full term", -> - assert.isTrue RankingUtils.matches(["MaRiO"], "MARIO", "MARio") + assert.isTrue RankingUtils.matches(["mario"], "MARIO", "MARio") should "do a case insensitive match on more than just two terms", -> - assert.isTrue RankingUtils.matches(["aRi"], "DOES_NOT_MATCH", "DOES_NOT_MATCH_EITHER", "MARio") + assert.isTrue RankingUtils.matches(["ari"], "DOES_NOT_MATCH", "DOES_NOT_MATCH_EITHER", "MARio") + + should "do a smartcase match", -> + assert.isTrue RankingUtils.matches(["Mar"], "Mario", "mario") + assert.isFalse RankingUtils.matches(["Mar"], "mario", "mario") + + should "do a smartcase match on full term", -> + assert.isTrue RankingUtils.matches(["Mario"], "Mario") + assert.isFalse RankingUtils.matches(["Mario"], "mario") should "do case insensitive word relevancy (matching)", -> - assert.isTrue RankingUtils.wordRelevancy(["aRi"], "MARIO", "MARio") > 0.0 + assert.isTrue RankingUtils.wordRelevancy(["ari"], "MARIO", "MARio") > 0.0 should "do case insensitive word relevancy (not matching)", -> assert.isTrue RankingUtils.wordRelevancy(["DOES_NOT_MATCH"], "MARIO", "MARio") == 0.0 |
