aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit_tests/completion_test.coffee
diff options
context:
space:
mode:
authorPhil Crosby2014-06-14 05:05:16 -0700
committerPhil Crosby2014-06-14 05:05:16 -0700
commitd674b10c38e1d9d6cf230391a23107ef53b82282 (patch)
tree47c50bf7f2467e5a6b3b0564e5eec7a62129c108 /tests/unit_tests/completion_test.coffee
parentf42690b1578de0b874048579354a17c251f567dd (diff)
parenta18ad484f2fdc0019c15d94405c915f8bfe6d76f (diff)
downloadvimium-d674b10c38e1d9d6cf230391a23107ef53b82282.tar.bz2
Merge pull request #1058 from mijoharas/custom_search_engines
Custom search engines
Diffstat (limited to 'tests/unit_tests/completion_test.coffee')
-rw-r--r--tests/unit_tests/completion_test.coffee14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/unit_tests/completion_test.coffee b/tests/unit_tests/completion_test.coffee
index 165bad46..02a741d5 100644
--- a/tests/unit_tests/completion_test.coffee
+++ b/tests/unit_tests/completion_test.coffee
@@ -229,6 +229,20 @@ context "tab completer",
assert.arrayEqual ["tab2.com"], results.map (tab) -> tab.url
assert.arrayEqual [2], results.map (tab) -> tab.tabId
+context "search engines",
+ setup ->
+ searchEngines = "foo: bar?q=%s\n# comment\nbaz: qux?q=%s"
+ Settings.set 'searchEngines', searchEngines
+ @completer = new SearchEngineCompleter()
+ # note, I couldn't just call @completer.refresh() here as I couldn't set root.Settings without errors
+ # workaround is below, would be good for someone that understands the testing system better than me to improve
+ @completer.searchEngines = Settings.getSearchEngines()
+
+ should "return search engine suggestion", ->
+ results = filterCompleter(@completer, ["foo", "hello"])
+ assert.arrayEqual ["bar?q=hello"], results.map (result) -> result.url
+ assert.arrayEqual ["foo: hello"], results.map (result) -> result.title
+
context "suggestions",
should "escape html in page titles", ->
suggestion = new Suggestion(["queryterm"], "tab", "url", "title <span>", returns(1))