diff --git a/contentcuration/contentcuration/frontend/channelEdit/views/files/__tests__/thumbnailGenerator.spec.js b/contentcuration/contentcuration/frontend/channelEdit/views/files/__tests__/thumbnailGenerator.spec.js index fef6d48296..d1cb615a48 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/views/files/__tests__/thumbnailGenerator.spec.js +++ b/contentcuration/contentcuration/frontend/channelEdit/views/files/__tests__/thumbnailGenerator.spec.js @@ -2,7 +2,7 @@ import { mount } from '@vue/test-utils'; import ThumbnailGenerator from '../thumbnails/ThumbnailGenerator'; import { factory } from '../../../store'; -function makeWrapper(filePath) { +async function makeWrapper(filePath) { const store = factory(); const handleFiles = jest.fn(() => true); @@ -22,7 +22,10 @@ function makeWrapper(filePath) { const generateVideoThumbnail = jest.spyOn(wrapper.vm, 'generateVideoThumbnail'); generateVideoThumbnail.mockImplementation(() => Promise.resolve()); - return [wrapper, { fileExists, generateVideoThumbnail, handleFiles }]; + const handleGenerated = jest.spyOn(wrapper.vm, 'handleGenerated'); + handleGenerated.mockImplementation(() => {}); + + return [wrapper, { fileExists, generateVideoThumbnail, handleFiles, handleGenerated }]; } describe('thumbnailGenerator', () => { @@ -30,22 +33,22 @@ describe('thumbnailGenerator', () => { it.each( ['test.mp4', 'test.webm', 'test.mp3'], - 'correct generation code should be called', - fileName => { - [wrapper, mocks] = makeWrapper(fileName); - wrapper.vm.generate(); + 'correct generation code should be called for %s', + async fileName => { + [wrapper, mocks] = await makeWrapper(fileName); + await wrapper.vm.generate(); expect(mocks.generateVideoThumbnail).toHaveBeenCalled(); }, ); - it('error alert should show if the file path is an unrecognized type', () => { - [wrapper, mocks] = makeWrapper('test.wut'); - wrapper.vm.generate(); + it('error alert should show if the file path is an unrecognized type', async () => { + [wrapper, mocks] = await makeWrapper('test.wut'); + await wrapper.vm.generate(); expect(wrapper.vm.showErrorAlert).toBe(true); }); it('handleGenerated should not call handleFiles if cancelled', async () => { - [wrapper, mocks] = makeWrapper('test.wut'); + [wrapper, mocks] = await makeWrapper('test.wut'); await wrapper.setData({ cancelled: true }); wrapper.vm.handleGenerated(''); expect(mocks.handleFiles).not.toHaveBeenCalled(); diff --git a/contentcuration/contentcuration/frontend/channelEdit/views/files/thumbnails/ThumbnailGenerator.vue b/contentcuration/contentcuration/frontend/channelEdit/views/files/thumbnails/ThumbnailGenerator.vue index c43bc6920f..ba9354ea76 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/views/files/thumbnails/ThumbnailGenerator.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/views/files/thumbnails/ThumbnailGenerator.vue @@ -1,11 +1,14 @@ @@ -67,19 +77,16 @@ import uniq from 'lodash/uniq'; import flatMap from 'lodash/flatMap'; import isFunction from 'lodash/isFunction'; - import { validateFile } from '../../vuex/file/validation'; import FileStorage from './FileStorage'; import FileDropzone from './FileDropzone'; import { MAX_FILE_SIZE } from 'shared/constants'; import { fileSizeMixin } from 'shared/mixins'; - import Alert from 'shared/views/Alert'; import { FormatPresetsList } from 'shared/leUtils/FormatPresets'; export default { name: 'Uploader', components: { - Alert, FileStorage, FileDropzone, }, @@ -260,6 +267,7 @@ tooLargeFilesHeader: 'Max file size exceeded', maxFileSizeText: '{count, plural,\n =1 {# file will not be uploaded.}\n other {# files will not be uploaded.}} File size must be under {size}', + closeButtonLabel: 'OK', }, }; @@ -275,7 +283,6 @@ .storage-usage { margin-top: -5px; font-size: 10pt; - color: gray; }