diff --git a/public/javascripts/stream.js b/public/javascripts/stream.js index 31573cb29..d392624fb 100644 --- a/public/javascripts/stream.js +++ b/public/javascripts/stream.js @@ -82,8 +82,6 @@ $(document).ready(function(){ $container.html('Invalid videotype '+$this.data("host")+' (ID: '+$this.data("video-id")+')'); } - - $container.hide(); this.parentNode.insertBefore(container, this.nextSibling); $container.slideDown('fast'); diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 3d7f6ee9c..b58357193 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -72,7 +72,7 @@ describe ApplicationHelper do markdownify(proto+"://"+url).should == ""+url+"" end - it "should recognize youtube links" do + it "recognizes youtube links" do proto="http" videoid = "0x__dDWdf23" url="www.youtube.com/watch?v="+videoid+"&a=GxdCwVVULXdvEBKmx_f5ywvZ0zZHHHDU&list=ML&playnext=1" @@ -81,10 +81,11 @@ describe ApplicationHelper do Net::HTTP.stub!(:new).with('gdata.youtube.com', 80).and_return(mock_http) mock_http.should_receive(:get).with('/feeds/api/videos/'+videoid+'?v=2', nil).and_return([nil, 'Foobar '+title+' hallo welt dsd']) res = markdownify(proto+'://'+url) - res.should == "Youtube: "+title+"" + res.should =~ /data-host="youtube.com"/ + res.should =~ /data-video-id="#{videoid}"/ end - it "should recognize a bunch of different links" do + it "recognizes multiple links of different types" do message = "http:// Hello World, this is for www.joindiaspora.com and not for http://www.google.com though their Youtube service is neat, take http://www.youtube.com/watch?v=foobar or www.youtube.com/watch?foo=bar&v=BARFOO&whatever=related It is a good idea we finally have youtube, so enjoy this video http://www.youtube.com/watch?v=rickrolld" mock_http = mock("http") Net::HTTP.stub!(:new).with('gdata.youtube.com', 80).and_return(mock_http) @@ -92,7 +93,11 @@ describe ApplicationHelper do mock_http.should_receive(:get).with('/feeds/api/videos/BARFOO?v=2', nil).and_return([nil, 'Foobar BAR is the new FOO hallo welt dsd']) mock_http.should_receive(:get).with('/feeds/api/videos/rickrolld?v=2', nil).and_return([nil, 'Foobar Never gonne give you up hallo welt dsd']) res = markdownify(message) - res.should == "http:// Hello World, this is for www.joindiaspora.com and not for www.google.com though their Youtube service is neat, take Youtube: F 007 - the bar is not enough or Youtube: BAR is the new FOO It is a good idea we finally have youtube, so enjoy this video Youtube: Never gonne give you up" + res.should =~ /a target=\"_blank\" href=\"http:\/\/www.joindiaspora.com\"/ + res.should =~ /a target=\"_blank\" href=\"http:\/\/www.google.com\"/ + res.should =~ /data-video-id="foobar"/ + res.should =~ /data-video-id="BARFOO"/ + res.should =~ /data-video-id="rickrolld"/ end it "should recognize basic ftp links" do @@ -172,22 +177,24 @@ describe ApplicationHelper do @message = "http://url.com www.url.com www.youtube.com/watch?foo=bar&v=BARFOO&whatever=related *emphasis* __emphasis__ [link](www.url.com) [link](url.com \"title\")" end - it "should allow to render only autolinks" do + it "can render only autolinks" do res = markdownify(@message, :youtube => false, :emphasis => false, :links => false) res.should == "url.com www.url.com www.youtube.com/watch?foo=bar&v=BARFOO&whatever=related *emphasis* __emphasis__ [link](www.url.com) [link](url.com "title")" end - it "should allow to render only youtube autolinks" do + it "can render only youtube" do res = markdownify(@message, :autolinks => false, :emphasis => false, :links => false) - res.should == "http://url.com www.url.com Youtube: BAR is the new FOO *emphasis* __emphasis__ [link](www.url.com) [link](url.com "title")" + res.should_not =~ /a href="http:\/\/url.com"/ + res.should_not =~ /a href="http:\/\/www.url.com"/ + res.should_not =~ /emphasis<\/strong>/ end - it "should allow to render only emphasis tags" do + it "can render only emphasis tags" do res = markdownify(@message, :autolinks => false, :youtube => false, :links => false) res.should == "http://url.com www.url.com www.youtube.com/watch?foo=bar&v=BARFOO&whatever=related emphasis emphasis [link](www.url.com) [link](url.com "title")" end - it "should allo to render only links tags" do + it "can render only links tags" do res = markdownify(@message, :autolinks => false, :youtube => false, :emphasis => false) res.should == "http://url.com www.url.com www.youtube.com/watch?foo=bar&v=BARFOO&whatever=related *emphasis* __emphasis__ link link" end