diff options
| author | mike-work | 2014-05-07 23:57:56 +0100 |
|---|---|---|
| committer | mike-work | 2014-05-29 02:42:51 +0100 |
| commit | a18ad484f2fdc0019c15d94405c915f8bfe6d76f (patch) | |
| tree | 3a8667096504d09b85ac0cd1cf4135763c95e375 /tests/unit_tests/completion_test.coffee | |
| parent | 1aa7ba3a5810742d14edfb738120b70f4a0f7619 (diff) | |
| download | vimium-a18ad484f2fdc0019c15d94405c915f8bfe6d76f.tar.bz2 | |
Adding in search engines feature to fix #1009
Diffstat (limited to 'tests/unit_tests/completion_test.coffee')
| -rw-r--r-- | tests/unit_tests/completion_test.coffee | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/unit_tests/completion_test.coffee b/tests/unit_tests/completion_test.coffee index fb267f63..43ecb49d 100644 --- a/tests/unit_tests/completion_test.coffee +++ b/tests/unit_tests/completion_test.coffee @@ -209,6 +209,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)) |
