Updated unit test
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
c442073eae
commit
59efc24077
|
@ -24,17 +24,30 @@ describe('Salix', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('viewportSelection()', () => {
|
describe('viewportSelection()', () => {
|
||||||
it('should call to displayEditor() and updatePhotoPreview() methods', () => {
|
it('should call to the updatePhotoPreview() method when uploadMethod property is set to "computer"', () => {
|
||||||
controller.displayEditor = jest.fn();
|
|
||||||
controller.updatePhotoPreview = jest.fn();
|
controller.updatePhotoPreview = jest.fn();
|
||||||
|
|
||||||
const files = [{name: 'test.jpg'}];
|
const files = [{name: 'test.jpg'}];
|
||||||
controller.newPhoto.files = files;
|
controller.newPhoto.files = files;
|
||||||
|
|
||||||
|
controller.uploadMethod = 'computer';
|
||||||
controller.viewportSelection = {code: 'normal'};
|
controller.viewportSelection = {code: 'normal'};
|
||||||
|
|
||||||
expect(controller.displayEditor).toHaveBeenCalledWith();
|
const firstFile = files[0];
|
||||||
expect(controller.updatePhotoPreview).toHaveBeenCalledWith(files);
|
|
||||||
|
expect(controller.updatePhotoPreview).toHaveBeenCalledWith(firstFile);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should call to the updatePhotoPreview() method when uploadMethod property is set to "URL"', () => {
|
||||||
|
controller.updatePhotoPreview = jest.fn();
|
||||||
|
|
||||||
|
const url = 'http://gothamcity.com/batman.png';
|
||||||
|
controller.newPhoto.url = url;
|
||||||
|
|
||||||
|
controller.uploadMethod = 'URL';
|
||||||
|
controller.viewportSelection = {code: 'normal'};
|
||||||
|
|
||||||
|
expect(controller.updatePhotoPreview).toHaveBeenCalledWith(url);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue