test/devcenter-parser_test.rb in devcenter-parser-2.2.9 vs test/devcenter-parser_test.rb in devcenter-parser-2.2.10

- old
+ new

@@ -40,12 +40,32 @@ md = '<strong>clean<script>alert("hack!")</script></strong>' html = '<p><strong>clean</strong></p>' assert_parsing_result md, html end - it 'allows embedding vimeo videos' do - src = '<iframe src="https://player.vimeo.com/video/61044807?title=0&amp;byline=0&amp;portrait=0&amp;color=a086ee" width="50" height="281" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>' + it 'allows embedding vimeo videos when their do-no-track param is set to true' do + src = '<iframe src="https://player.vimeo.com/video/143343818?api=1&amp;dnt=true&amp;title=foo" width="50" height="281" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>' assert_parsing_result src, src + end + + it 'allows embedding youtube videos from its no-cookies domain' do + src = '<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/123456ABCDEF" frameborder="0" allowfullscreen=""></iframe>' + assert_parsing_result src, src + end + + it 'removes youtube videos embedded from the with-cookies domain' do + src = '<iframe width="560" height="315" src="https://www.youtube.com/embed/123456ABCDEF" frameborder="0" allowfullscreen=""></iframe>' + assert_parsing_result src, '' + end + + it 'does not allow embedding vimeo videos when their do-no-track param is set to something different than true' do + src = '<iframe src="https://player.vimeo.com/video/143343818?api=1&amp;dnt=foo&amp;title=foo" width="50" height="281" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>' + assert_parsing_result src, '' + end + + it 'does not allow embedding vimeo videos when their do-no-track param is not passed' do + src = '<iframe src="https://player.vimeo.com/video/143343818?api=1&&amp;title=foo" width="50" height="281" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>' + assert_parsing_result src, '' end it 'allows images' do src = '<p><img src="http://nav.heroku.com/images/logos/logo.png" alt="image"></p>' assert_parsing_result src, src