expect($summary.find('.fileinfo').text()).toEqual('2 files');
expect($summary.find('.dirinfo').hasClass('hidden')).toEqual(false);
expect($summary.find('.fileinfo').hasClass('hidden')).toEqual(false);
- expect($summary.find('.filesize').text()).toEqual('69 KB');
+ expect($summary.find('.filesize').text()).toEqual('70 KB');
expect(fileList.isEmpty).toEqual(false);
});
it('Shows empty content when removing last file', function() {
expect($summary.find('.fileinfo').text()).toEqual('1 file');
expect($summary.find('.dirinfo').hasClass('hidden')).toEqual(false);
expect($summary.find('.fileinfo').hasClass('hidden')).toEqual(false);
- expect($summary.find('.filesize').text()).toEqual('57 KB');
+ expect($summary.find('.filesize').text()).toEqual('58 KB');
expect(fileList.isEmpty).toEqual(false);
expect($('.files-filestable thead th').hasClass('hidden')).toEqual(false);
expect($('.emptyfilelist.emptycontent').hasClass('hidden')).toEqual(true);
expect($summary.hasClass('hidden')).toEqual(false);
expect($summary.find('.dirinfo').text()).toEqual('1 folder');
expect($summary.find('.fileinfo').text()).toEqual('3 files');
- expect($summary.find('.filesize').text()).toEqual('69 KB');
+ expect($summary.find('.filesize').text()).toEqual('70 KB');
});
it('shows headers, summary and hide empty content message after setting files', function(){
fileList.setFiles(testFiles);
expect($container.hasClass('hidden')).toEqual(false);
expect($container.find('.dirinfo').text()).toEqual('5 folders');
expect($container.find('.fileinfo').text()).toEqual('2 files');
- expect($container.find('.filesize').text()).toEqual('250 KB');
+ expect($container.find('.filesize').text()).toEqual('256 KB');
});
it('hides summary when no files or folders', function() {
var s = new FileSummary($container);
expect($container.hasClass('hidden')).toEqual(false);
expect($container.find('.dirinfo').text()).toEqual('6 folders');
expect($container.find('.fileinfo').text()).toEqual('3 files');
- expect($container.find('.filesize').text()).toEqual('500 KB');
+ expect($container.find('.filesize').text()).toEqual('512 KB');
expect(s.summary.totalDirs).toEqual(6);
expect(s.summary.totalFiles).toEqual(3);
expect(s.summary.totalSize).toEqual(512100);
expect($container.hasClass('hidden')).toEqual(false);
expect($container.find('.dirinfo').text()).toEqual('4 folders');
expect($container.find('.fileinfo').text()).toEqual('1 file');
- expect($container.find('.filesize').text()).toEqual('125 KB');
+ expect($container.find('.filesize').text()).toEqual('128 KB');
expect(s.summary.totalDirs).toEqual(4);
expect(s.summary.totalFiles).toEqual(1);
expect(s.summary.totalSize).toEqual(127900);
expect($container.find('.dirinfo').text()).toEqual('5 folders');
expect($container.find('.fileinfo').text()).toEqual('2 files');
expect($container.find('.filter').text()).toEqual(' match "foo"');
- expect($container.find('.filesize').text()).toEqual('250 KB');
+ expect($container.find('.filesize').text()).toEqual('256 KB');
});
it('hides filtered summary when no files or folders', function() {
var s = new FileSummary($container);
expect($container.find('.dirinfo').text()).toEqual('6 folders');
expect($container.find('.fileinfo').text()).toEqual('3 files');
expect($container.find('.filter').text()).toEqual(' match "foo"');
- expect($container.find('.filesize').text()).toEqual('500 KB');
+ expect($container.find('.filesize').text()).toEqual('512 KB');
expect(s.summary.totalDirs).toEqual(6);
expect(s.summary.totalFiles).toEqual(3);
expect(s.summary.totalSize).toEqual(512103);
expect($container.find('.dirinfo').text()).toEqual('4 folders');
expect($container.find('.fileinfo').text()).toEqual('1 file');
expect($container.find('.filter').text()).toEqual(' match "foo"');
- expect($container.find('.filesize').text()).toEqual('125 KB');
+ expect($container.find('.filesize').text()).toEqual('128 KB');
expect(s.summary.totalDirs).toEqual(4);
expect(s.summary.totalFiles).toEqual(1);
expect(s.summary.totalSize).toEqual(127903);
expect($container.find('.fileinfo').text()).toEqual('1 file');
expect($container.find('.hiddeninfo').hasClass('hidden')).toEqual(false);
expect($container.find('.hiddeninfo').text()).toEqual(' (including 1 hidden)');
- expect($container.find('.filesize').text()).toEqual('750 KB');
+ expect($container.find('.filesize').text()).toEqual('768 KB');
});
it('does not render hidden count section when hidden files exist but are visible', function() {
window._nc_event_bus.emit('files:config:updated', { key: 'show_hidden', value: true });
expect($container.find('.dirinfo').text()).toEqual('2 folders');
expect($container.find('.fileinfo').text()).toEqual('1 file');
expect($container.find('.hiddeninfo').hasClass('hidden')).toEqual(true);
- expect($container.find('.filesize').text()).toEqual('750 KB');
+ expect($container.find('.filesize').text()).toEqual('768 KB');
});
it('does not render hidden count section when no hidden files exist', function() {
window._nc_event_bus.emit('files:config:updated', { key: 'show_hidden', value: false });
expect($container.find('.dirinfo').text()).toEqual('1 folder');
expect($container.find('.fileinfo').text()).toEqual('1 file');
expect($container.find('.hiddeninfo').hasClass('hidden')).toEqual(true);
- expect($container.find('.filesize').text()).toEqual('250 KB');
+ expect($container.find('.filesize').text()).toEqual('256 KB');
});
});
});
+++ /dev/null
-/**
-* ownCloud
-*
-* @author Vincent Petry
-* @copyright 2015 Vincent Petry <pvince81@owncloud.com>
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
-* version 3 of the License, or any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Affero General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
-*
-*/
-
-describe('Apps base tests', function() {
- describe('Sidebar utility functions', function() {
- beforeEach(function() {
- $('#testArea').append('<div id="content"><div id="app-content">Content</div><div id="app-sidebar">The sidebar</div></div>');
- jQuery.fx.off = true;
- });
- afterEach(function() {
- jQuery.fx.off = false;
- });
- it('shows sidebar', function() {
- var $el = $('#app-sidebar');
- OC.Apps.showAppSidebar();
- expect($el.hasClass('disappear')).toEqual(false);
- });
- it('hides sidebar', function() {
- var $el = $('#app-sidebar');
- OC.Apps.showAppSidebar();
- OC.Apps.hideAppSidebar();
- expect($el.hasClass('disappear')).toEqual(true);
- });
- it('triggers appresize event when visibility changed', function() {
- var eventStub = sinon.stub();
- $('#content').on('appresized', eventStub);
- OC.Apps.showAppSidebar();
- expect(eventStub.calledOnce).toEqual(true);
- OC.Apps.hideAppSidebar();
- expect(eventStub.calledTwice).toEqual(true);
- });
- });
-});
-