From 0c70ada9d740b532f88c83169b7c14aeda76b65d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Eixarch?= Date: Wed, 21 Nov 2012 03:35:49 +0100 Subject: [PATCH 1/3] Allow ! in urls autodetection --- src/static/js/linestylefilter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/static/js/linestylefilter.js b/src/static/js/linestylefilter.js index c6434b6c2..e6fbc2096 100644 --- a/src/static/js/linestylefilter.js +++ b/src/static/js/linestylefilter.js @@ -259,7 +259,7 @@ linestylefilter.getRegexpFilter = function(regExp, tag) linestylefilter.REGEX_WORDCHAR = /[\u0030-\u0039\u0041-\u005A\u0061-\u007A\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\u1FFF\u3040-\u9FFF\uF900-\uFDFF\uFE70-\uFEFE\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFDC]/; -linestylefilter.REGEX_URLCHAR = new RegExp('(' + /[-:@a-zA-Z0-9_.,~%+\/\\?=&#;()$]/.source + '|' + linestylefilter.REGEX_WORDCHAR.source + ')'); +linestylefilter.REGEX_URLCHAR = new RegExp('(' + /[-:@a-zA-Z0-9_.,~%+\/\\?=&#!;()$]/.source + '|' + linestylefilter.REGEX_WORDCHAR.source + ')'); linestylefilter.REGEX_URL = new RegExp(/(?:(?:https?|s?ftp|ftps|file|smb|afp|nfs|(x-)?man|gopher|txmt):\/\/|mailto:|www\.)/.source + linestylefilter.REGEX_URLCHAR.source + '*(?![:.,;])' + linestylefilter.REGEX_URLCHAR.source, 'g'); linestylefilter.getURLFilter = linestylefilter.getRegexpFilter( linestylefilter.REGEX_URL, 'url'); From 2260b1fc6282589ecb90b8d530ced5c12e054071 Mon Sep 17 00:00:00 2001 From: John McLear Date: Wed, 21 Nov 2012 17:52:10 +0000 Subject: [PATCH 2/3] Test for PR 1188 https://github.com/ether/etherpad-lite/pull/1188 --- .../specs/keystroke_urls_become_clickable.js | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/frontend/specs/keystroke_urls_become_clickable.js b/tests/frontend/specs/keystroke_urls_become_clickable.js index 2a46360e8..8c72d748e 100644 --- a/tests/frontend/specs/keystroke_urls_become_clickable.js +++ b/tests/frontend/specs/keystroke_urls_become_clickable.js @@ -21,4 +21,27 @@ describe("urls", function(){ return inner$("div").first().find("a").length === 1; }, 2000).done(done); }); + + it("when you enter a url containing a !, it becomes clickable and contains the whole URL", function(done) { + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; + + //get the first text element out of the inner iframe + var firstTextElement = inner$("div").first(); + var url = "http://etherpad.org/!foo"; + + // simulate key presses to delete content + firstTextElement.sendkeys('{selectall}'); // select all + firstTextElement.sendkeys('{del}'); // clear the first line + firstTextElement.sendkeys(url); // insert a URL + + helper.waitFor(function(){ + if(inner$("div").first().find("a").length === 1){ // if it contains an A link + if(inner$("div").first().find("a")[0].href === url){ + return true; + } + }; + }, 2000).done(done); + }); + }); From db5119f798b9e513c51b757b9cf076eb5dae0bb4 Mon Sep 17 00:00:00 2001 From: John McLear Date: Wed, 21 Nov 2012 17:53:46 +0000 Subject: [PATCH 3/3] Fix tests to run on IE8 etc. A bit more fragile but so is the life of supporting older browsers. --- tests/frontend/specs/language.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/tests/frontend/specs/language.js b/tests/frontend/specs/language.js index 83bb84583..f93bc33d3 100644 --- a/tests/frontend/specs/language.js +++ b/tests/frontend/specs/language.js @@ -21,12 +21,8 @@ describe("Language select and change", function(){ $languageoption.attr('selected','selected'); $language.change(); - var localizedEventFired = false; - $(chrome$.window).bind('localized', function() { - localizedEventFired = true; - }) - - helper.waitFor(function() { return localizedEventFired;}) + var current = $language.val(); + helper.waitFor(function() { return $language.val() != current}) // GOT IT? .done(function(){ //get the value of the bold button var $boldButton = chrome$(".buttonicon-bold").parent(); @@ -56,12 +52,8 @@ describe("Language select and change", function(){ $languageoption.attr('selected','selected'); $language.change(); - var localizedEventFired = false; - $(chrome$.window).bind('localized', function() { - localizedEventFired = true; - }) - - helper.waitFor(function() { return localizedEventFired;}) + var current = $language.val(); + helper.waitFor(function() { return $language.val() != current}) .done(function(){ //get the value of the bold button @@ -78,4 +70,3 @@ describe("Language select and change", function(){ }); }); -