Commit 386754a9 authored by Jesse Hall's avatar Jesse Hall Committed by Peter Leitzen

Fix for #198353, copied and pasted markdown video/audio snippets not playable

parent d8149c08
......@@ -42,7 +42,7 @@ export default class Playable extends Node {
},
{
tag: `${this.mediaType}[src]`,
getAttrs: el => ({ src: el.getAttribute('src'), alt: el.dataset.title }),
getAttrs: el => ({ src: el.src, alt: el.dataset.title }),
},
];
......
......@@ -172,18 +172,36 @@ describe 'Copy as GFM', :js do
'![Image](https://example.com/image.png)'
)
verify_media_with_partial_path(
'![Image](/uploads/a123/image.png)',
project_media_uri(@project, '/uploads/a123/image.png')
)
verify(
'VideoLinkFilter',
'![Video](https://example.com/video.mp4)'
)
verify_media_with_partial_path(
'![Video](/uploads/a123/video.mp4)',
project_media_uri(@project, '/uploads/a123/video.mp4')
)
verify(
'AudioLinkFilter',
'![Audio](https://example.com/audio.wav)'
)
verify_media_with_partial_path(
'![Audio](/uploads/a123/audio.wav)',
project_media_uri(@project, '/uploads/a123/audio.wav')
)
verify(
'MathFilter: math as converted from GFM to HTML',
......@@ -647,6 +665,16 @@ describe 'Copy as GFM', :js do
end
end
def project_media_uri(project, media_path)
"#{project_path(project)}#{media_path}"
end
def verify_media_with_partial_path(gfm, media_uri)
html = gfm_to_html(gfm)
output_gfm = html_to_gfm(html)
expect(output_gfm).to include(media_uri)
end
# Fake a `current_user` helper
def current_user
@feat.user
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment