From f761ecf620a103268cb11d49f64768afb4bab08b Mon Sep 17 00:00:00 2001 From: Phil Crosby Date: Sun, 10 Jun 2012 00:49:16 -0700 Subject: Complete tabs in the omnibar. Right now this is triggered on Shift+T. Firefox also does tab matching in their omnibar. I'm not sure if collapsing the two searches into one UI is a good idea. --- tests/completion_test.coffee | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests') diff --git a/tests/completion_test.coffee b/tests/completion_test.coffee index 218225d4..a46dbbf2 100644 --- a/tests/completion_test.coffee +++ b/tests/completion_test.coffee @@ -119,6 +119,19 @@ context "domain completer", should "returns no results when there's more than one query term, because clearly it's not a domain", -> assert.arrayEqual [], filterCompleter(@completer, ["his", "tory"]) +context "tab completer", + setup -> + @tabs = [ + { url: "tab1.com", title: "tab1", id: 1 } + { url: "tab2.com", title: "tab2", id: 2 }] + chrome.tabs = { query: (args, onComplete) => onComplete(@tabs) } + @completer = new TabCompleter() + + should "return matching tabs", -> + results = filterCompleter(@completer, ["tab2"]) + assert.equal "tab2.com", results.map (tab) -> tab.url + assert.equal 2, results.map (tab) -> tab.tabId + context "suggestions", should "escape html in page titles", -> suggestion = new Suggestion(["queryterm"], "tab", "url", "title ", returns(1)) -- cgit v1.2.3