diff options
| author | Stephen Blott | 2015-05-10 05:35:50 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-05-10 05:39:15 +0100 |
| commit | 313a1f96d666f23c2bc75ef340f0f828319e127c (patch) | |
| tree | 8061232ac2d1affd10627f220381572dd6a1b001 /tests/unit_tests | |
| parent | 275a91f203086b8f81542c174e736748dce68628 (diff) | |
| download | vimium-313a1f96d666f23c2bc75ef340f0f828319e127c.tar.bz2 | |
Search completion; refactor searchEngineCompleter.
This revamps how search-engine configuration is handled, and revises
some rather strange legacy code.
Diffstat (limited to 'tests/unit_tests')
| -rw-r--r-- | tests/unit_tests/completion_test.coffee | 21 | ||||
| -rw-r--r-- | tests/unit_tests/settings_test.coffee | 9 |
2 files changed, 0 insertions, 30 deletions
diff --git a/tests/unit_tests/completion_test.coffee b/tests/unit_tests/completion_test.coffee index b45c99dd..7711dac4 100644 --- a/tests/unit_tests/completion_test.coffee +++ b/tests/unit_tests/completion_test.coffee @@ -236,27 +236,6 @@ 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 baz description" - 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 = SearchEngineCompleter.getSearchEngines() - - should "return search engine suggestion without description", -> - results = filterCompleter(@completer, ["foo", "hello"]) - assert.arrayEqual ["bar?q=hello"], results.map (result) -> result.url - assert.arrayEqual ["hello"], results.map (result) -> result.title - assert.arrayEqual ["search [foo]"], results.map (result) -> result.type - - should "return search engine suggestion with description", -> - results = filterCompleter(@completer, ["baz", "hello"]) - # assert.arrayEqual ["qux?q=hello"], results.map (result) -> result.searchUrl - # assert.arrayEqual ["hello"], results.map (result) -> result.title - # assert.arrayEqual ["baz description"], results.map (result) -> result.type - context "suggestions", should "escape html in page titles", -> suggestion = new Suggestion diff --git a/tests/unit_tests/settings_test.coffee b/tests/unit_tests/settings_test.coffee index 52eec30d..4cd20211 100644 --- a/tests/unit_tests/settings_test.coffee +++ b/tests/unit_tests/settings_test.coffee @@ -70,14 +70,5 @@ context "settings", chrome.storage.sync.set { scrollStepSize: JSON.stringify(message) } assert.equal message, Sync.message - should "set search engines, retrieve them correctly and check that they have been parsed correctly", -> - searchEngines = "foo: bar?q=%s\n# comment\nbaz: qux?q=%s baz description" - Settings.set 'searchEngines', searchEngines - result = SearchEngineCompleter.getSearchEngines() - assert.equal "bar?q=%s", result["foo"].searchUrl - assert.isFalse result["foo"].description - assert.equal "qux?q=%s", result["baz"].searchUrl - assert.equal "baz description", result["baz"].description - should "sync a key which is not a known setting (without crashing)", -> chrome.storage.sync.set { notASetting: JSON.stringify("notAUsefullValue") } |
