Commit fdabbc36 authored by Jacques's avatar Jacques Committed by Peter Hegman

Add video viewer

Added a video viewer as part of the blob refactor
parent 0335e0c4
......@@ -10,6 +10,8 @@ export const loadViewer = (type) => {
return () => import(/* webpackChunkName: 'blob_download_viewer' */ './download_viewer.vue');
case 'image':
return () => import(/* webpackChunkName: 'blob_image_viewer' */ './image_viewer.vue');
case 'video':
return () => import(/* webpackChunkName: 'blob_video_viewer' */ './video_viewer.vue');
default:
return null;
}
......@@ -31,5 +33,8 @@ export const viewerProps = (type, blob) => {
url: blob.rawPath,
alt: blob.name,
},
video: {
url: blob.rawPath,
},
}[type];
};
<script>
export default {
props: {
url: {
type: String,
required: true,
},
},
};
</script>
<template>
<div class="gl-text-center gl-p-7 gl-bg-gray-50">
<video :src="url" controls data-testid="video" class="gl-max-w-full"></video>
</div>
</template>
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import VideoViewer from '~/repository/components/blob_viewers/video_viewer.vue';
describe('Video Viewer', () => {
let wrapper;
const propsData = { url: 'some/video.mp4' };
const createComponent = () => {
wrapper = shallowMountExtended(VideoViewer, { propsData });
};
const findVideo = () => wrapper.findByTestId('video');
it('renders a Video element', () => {
createComponent();
expect(findVideo().exists()).toBe(true);
expect(findVideo().attributes('src')).toBe(propsData.url);
expect(findVideo().attributes('controls')).not.toBeUndefined();
});
});
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