Commit 6900c228 authored by Kostas Ioannou's avatar Kostas Ioannou

Add audio blob viewer

parent 93a0a6a4
<script>
export default {
props: {
blob: {
type: Object,
required: true,
},
},
data() {
return {
src: this.blob.rawPath,
};
},
};
</script>
<template>
<div class="gl-text-center gl-p-7">
<audio :src="src" controls data-testid="audio"></audio>
</div>
</template>
......@@ -6,6 +6,7 @@ const viewers = {
text: () => import('~/vue_shared/components/source_viewer/source_viewer.vue'),
pdf: () => import('./pdf_viewer.vue'),
lfs: () => import('./lfs_viewer.vue'),
audio: () => import('./audio_viewer.vue'),
};
export const loadViewer = (type, isUsingLfs) => {
......
import { shallowMount } from '@vue/test-utils';
import AudioViewer from '~/repository/components/blob_viewers/audio_viewer.vue';
describe('Audio Viewer', () => {
let wrapper;
const DEFAULT_BLOB_DATA = {
rawPath: 'some/audio.mid',
};
const createComponent = () => {
wrapper = shallowMount(AudioViewer, { propsData: { blob: DEFAULT_BLOB_DATA } });
};
const findImage = () => wrapper.find('[data-testid="audio"]');
it('renders an audio source component', () => {
createComponent();
expect(findImage().exists()).toBe(true);
expect(findImage().attributes('src')).toBe(DEFAULT_BLOB_DATA.rawPath);
});
});
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