diff options
author | Rémy Coutable <remy@rymai.me> | 2016-07-12 20:28:39 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-07-20 12:36:42 +0300 |
commit | 6b7e9c7655e4ffc74de90f01a0850a230b10a03c (patch) | |
tree | da865eb7dff81588d426907afcc74d6a072fe3fa /spec/lib/banzai/filter/video_link_filter_spec.rb | |
parent | 98e540532cc2706e4cdc027bd2acb8406e954ddc (diff) |
Remove VideoJS and clean the integration
Handle videos in:
- MD preview in notes: commit, issue/MR, MR diff
- New notes in: commit, issue/MR, MR diff
- Persisted notes in: commit, issue/MR, MR diff
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/lib/banzai/filter/video_link_filter_spec.rb')
-rw-r--r-- | spec/lib/banzai/filter/video_link_filter_spec.rb | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/spec/lib/banzai/filter/video_link_filter_spec.rb b/spec/lib/banzai/filter/video_link_filter_spec.rb index bdf76c458b0..cc4349f80ba 100644 --- a/spec/lib/banzai/filter/video_link_filter_spec.rb +++ b/spec/lib/banzai/filter/video_link_filter_spec.rb @@ -18,24 +18,33 @@ describe Banzai::Filter::VideoLinkFilter, lib: true do context 'when the element src has a video extension' do UploaderHelper::VIDEO_EXT.each do |ext| it "replaces the image tag 'path/video.#{ext}' with a video tag" do - element = filter(link_to_image("/path/video.#{ext}")).children.first + container = filter(link_to_image("/path/video.#{ext}")).children.first - expect(element.name).to eq 'video' - expect(element['src']).to eq "/path/video.#{ext}" + expect(container.name).to eq 'div' + expect(container['class']).to eq 'video-container' - fallback_link = element.children.first - expect(fallback_link.name).to eq 'a' - expect(fallback_link['href']).to eq "/path/video.#{ext}" - expect(fallback_link['target']).to eq '_blank' + video, paragraph = container.children + + expect(video.name).to eq 'video' + expect(video['src']).to eq "/path/video.#{ext}" + + expect(paragraph.name).to eq 'p' + + link = paragraph.children.first + + expect(link.name).to eq 'a' + expect(link['href']).to eq "/path/video.#{ext}" + expect(link['target']).to eq '_blank' end end end context 'when the element src is an image' do it 'leaves the document unchanged' do - element = filter(link_to_image("/path/my_image.jpg")).children.first + element = filter(link_to_image('/path/my_image.jpg')).children.first expect(element.name).to eq 'img' + expect(element['src']).to eq '/path/my_image.jpg' end end |