aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorStephen Blott2015-05-18 07:04:38 +0100
committerStephen Blott2015-05-18 07:04:38 +0100
commitf38b77a1899ebc13a684c50b1c4b803c87df63b5 (patch)
treec6b066d1989b105fe61a456a99cb6cce84c3dfd0 /tests
parentc16b1c20e20c27b0e46038326fd97f1a721634ef (diff)
parent904398308debad22fedec227ec8e71adb2bc5720 (diff)
downloadvimium-f38b77a1899ebc13a684c50b1c4b803c87df63b5.tar.bz2
Merge branch 'vomnibar-insert-history-with-tab'
Conflicts: background_scripts/completion.coffee
Diffstat (limited to 'tests')
-rw-r--r--tests/unit_tests/utils_test.coffee10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/unit_tests/utils_test.coffee b/tests/unit_tests/utils_test.coffee
index d1444af2..bfe066c3 100644
--- a/tests/unit_tests/utils_test.coffee
+++ b/tests/unit_tests/utils_test.coffee
@@ -49,6 +49,16 @@ context "convertToUrl",
assert.equal "https://www.google.com/search?q=go+ogle.com", Utils.convertToUrl("go ogle.com")
assert.equal "https://www.google.com/search?q=%40twitter", Utils.convertToUrl("@twitter")
+context "extractQuery",
+ should "extract queries from search URLs", ->
+ assert.equal "bbc sport 1", Utils.extractQuery "https://www.google.ie/search?q=%s", "https://www.google.ie/search?q=bbc+sport+1"
+ assert.equal "bbc sport 2", Utils.extractQuery "http://www.google.ie/search?q=%s", "https://www.google.ie/search?q=bbc+sport+2"
+ assert.equal "bbc sport 3", Utils.extractQuery "https://www.google.ie/search?q=%s", "http://www.google.ie/search?q=bbc+sport+3"
+ assert.equal "bbc sport 4", Utils.extractQuery "https://www.google.ie/search?q=%s", "http://www.google.ie/search?q=bbc+sport+4&blah"
+
+ should "extract not queries from incorrect search URLs", ->
+ assert.isFalse Utils.extractQuery "https://www.google.ie/search?q=%s&foo=bar", "https://www.google.ie/search?q=bbc+sport"
+
context "hasChromePrefix",
should "detect chrome prefixes of URLs", ->
assert.isTrue Utils.hasChromePrefix "about:foobar"