Skip to content
Snippets Groups Projects
Commit 734c6b0b authored by Arthur Schiwon's avatar Arthur Schiwon
Browse files

extend MainFileInfoDetailView JS tests

parent 7a982872
Branches
No related tags found
No related merge requests found
...@@ -20,16 +20,19 @@ ...@@ -20,16 +20,19 @@
*/ */
describe('OCA.Files.MainFileInfoDetailView tests', function() { describe('OCA.Files.MainFileInfoDetailView tests', function() {
var view, tipsyStub; var view, tipsyStub, previewStub, fncLazyLoadPreview, fileListMock;
beforeEach(function() { beforeEach(function() {
tipsyStub = sinon.stub($.fn, 'tipsy'); tipsyStub = sinon.stub($.fn, 'tipsy');
fileListMock = sinon.mock(OCA.Files.FileList.prototype);
view = new OCA.Files.MainFileInfoDetailView(); view = new OCA.Files.MainFileInfoDetailView();
}); });
afterEach(function() { afterEach(function() {
view.destroy(); view.destroy();
view = undefined; view = undefined;
tipsyStub.restore(); tipsyStub.restore();
fileListMock.restore();
}); });
describe('rendering', function() { describe('rendering', function() {
var testFileInfo; var testFileInfo;
...@@ -68,10 +71,33 @@ describe('OCA.Files.MainFileInfoDetailView tests', function() { ...@@ -68,10 +71,33 @@ describe('OCA.Files.MainFileInfoDetailView tests', function() {
.toEqual(OC.imagePath('core', 'actions/star')); .toEqual(OC.imagePath('core', 'actions/star'));
}); });
it('displays mime icon', function() { it('displays mime icon', function() {
// TODO // File
view.setFileInfo(_.extend(testFileInfo, {
mimetype: 'text/calendar'
}));
expect(view.$el.find('.thumbnail').css('background-image'))
.toContain('filetypes/text-calendar.svg');
// Folder
view.setFileInfo(_.extend(testFileInfo, {
mimetype: 'httpd/unix-directory'
}));
expect(view.$el.find('.thumbnail').css('background-image'))
.toContain('filetypes/folder.svg');
}); });
it('displays thumbnail', function() { it('displays thumbnail', function() {
// TODO view.setFileInfo(_.extend(testFileInfo, {
mimetype: 'text/plain'
}));
var expectation = fileListMock.expects('lazyLoadPreview');
expectation.once();
view.setFileInfo(testFileInfo);
fileListMock.verify();
}); });
}); });
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment