From fbdff8626a8db7be33a6b7790a35e48c4c5231aa Mon Sep 17 00:00:00 2001 From: Jez Ng Date: Sun, 15 Jan 2012 17:39:58 +0800 Subject: Handle pasted URLs intelligently. --- test_harnesses/automated.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test_harnesses') diff --git a/test_harnesses/automated.html b/test_harnesses/automated.html index 5e3ae93c..764b0d2f 100644 --- a/test_harnesses/automated.html +++ b/test_harnesses/automated.html @@ -250,6 +250,19 @@ ); + context("Web query parsing", + + should("Convert query string to valid URL", function() { + assert.equal("http://www.google.com/", utils.ensureUrl("http://www.google.com/")); + assert.equal("http://www.google.com/", utils.ensureUrl(" http://www.google.com/ ")); + assert.equal("http://www.google.com", utils.ensureUrl("www.google.com")); + assert.equal("http://google.com", utils.ensureUrl("google.com")); + assert.equal("http://www.google.com/search?q=google", utils.ensureUrl("google")); + assert.equal("http://www.google.com/search?q=go ogle.com", utils.ensureUrl("go ogle.com")); + }) + + ); + Tests.outputMethod = function(output) { var newOutput = Array.prototype.join.call(arguments, "\n"); newOutput = newOutput.replace(/&/g,"&").replace(//g,">"); // escape html -- cgit v1.2.3