Permalink
Browse files

add test for wmode param for youtube filter

  • Loading branch information...
1 parent 9ef15bb commit 177ca61d92259831817603db009386c183cf27a6 @dejan dejan committed Dec 7, 2011
Showing with 4 additions and 6 deletions.
  1. +1 −1 lib/auto_html/filters/youtube.rb
  2. +3 −5 test/unit/filters/youtube_test.rb
@@ -7,7 +7,7 @@
frameborder = options[:frameborder]
wmode = options[:wmode]
src = "http://www.youtube.com/embed/#{youtube_id}"
- src += "wmode=#{wmode}" if wmode
+ src += "?wmode=#{wmode}" if wmode
%{<iframe width="#{width}" height="#{height}" src="#{src}" frameborder="#{frameborder}" allowfullscreen></iframe>}
end
end
@@ -23,14 +23,12 @@ def test_transform_url_without_www
end
def test_transform_with_options
- result = auto_html('http://www.youtube.com/watch?v=BwNrmYRiX_o') { youtube(:width => 300, :height => 255, :frameborder => 1) }
- assert_equal '<iframe width="300" height="255" src="http://www.youtube.com/embed/BwNrmYRiX_o" frameborder="1" allowfullscreen></iframe>', result
+ result = auto_html('http://www.youtube.com/watch?v=BwNrmYRiX_o') { youtube(:width => 300, :height => 255, :frameborder => 1, :wmode => 'window') }
+ assert_equal '<iframe width="300" height="255" src="http://www.youtube.com/embed/BwNrmYRiX_o?wmode=window" frameborder="1" allowfullscreen></iframe>', result
end
-
-
+
def test_transform_with_short_url
result = auto_html('http://www.youtu.be/BwNrmYRiX_o') { youtube }
assert_equal '<iframe width="420" height="315" src="http://www.youtube.com/embed/BwNrmYRiX_o" frameborder="0" allowfullscreen></iframe>', result
end
-
end

0 comments on commit 177ca61

Please sign in to comment.