summaryrefslogtreecommitdiffstats
path: root/apps/files/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-08-17 17:34:15 +0200
committerLukas Reschke <lukas@statuscode.ch>2016-08-19 10:26:19 +0200
commitf7deb2c2eb23b7dc2eb7a10c0ef6400f86236d82 (patch)
tree70e35c3f21751c14ac098a216f4d58005d4d7bc7 /apps/files/tests
parent3ccd69707e75c3d99156c41d8107621e07a01ded (diff)
downloadnextcloud-server-f7deb2c2eb23b7dc2eb7a10c0ef6400f86236d82.tar.gz
nextcloud-server-f7deb2c2eb23b7dc2eb7a10c0ef6400f86236d82.zip
Fix hidden files handling
Hidden files (dot files) are now always rendered in the DOM to make sure that all file operations and selection still work as expected. Their visibility is now toggled on CSS level.
Diffstat (limited to 'apps/files/tests')
-rw-r--r--apps/files/tests/js/filelistSpec.js37
1 files changed, 36 insertions, 1 deletions
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index 651ba6eef1e..cf9f43f2d59 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -24,6 +24,7 @@ describe('OCA.Files.FileList tests', function() {
var testFiles, testRoot, notificationStub, fileList, pageSizeStub;
var bcResizeStub;
var filesClient;
+ var filesConfig;
var redirectStub;
/**
@@ -54,6 +55,10 @@ describe('OCA.Files.FileList tests', function() {
}
beforeEach(function() {
+ filesConfig = new OC.Backbone.Model({
+ showhidden: true
+ });
+
filesClient = new OC.Files.Client({
host: 'localhost',
port: 80,
@@ -153,7 +158,8 @@ describe('OCA.Files.FileList tests', function() {
})];
pageSizeStub = sinon.stub(OCA.Files.FileList.prototype, 'pageSize').returns(20);
fileList = new OCA.Files.FileList($('#app-content-files'), {
- filesClient: filesClient
+ filesClient: filesClient,
+ config: filesConfig
});
});
afterEach(function() {
@@ -407,6 +413,35 @@ describe('OCA.Files.FileList tests', function() {
}
});
});
+ describe('Hidden files', function() {
+ it('sets the class hidden-file for hidden files', function() {
+ var fileData = {
+ type: 'dir',
+ name: '.testFolder'
+ };
+ var $tr = fileList.add(fileData);
+
+ expect($tr).toBeDefined();
+ expect($tr.hasClass('hidden-file')).toEqual(true);
+ });
+ it('does not set the class hidden-file for visible files', function() {
+ var fileData = {
+ type: 'dir',
+ name: 'testFolder'
+ };
+ var $tr = fileList.add(fileData);
+
+ expect($tr).toBeDefined();
+ expect($tr.hasClass('hidden-file')).toEqual(false);
+ });
+ it('toggles the list\'s class when toggling hidden files', function() {
+ expect(fileList.$el.hasClass('hide-hidden-files')).toEqual(false);
+ filesConfig.set('showhidden', false);
+ expect(fileList.$el.hasClass('hide-hidden-files')).toEqual(true);
+ filesConfig.set('showhidden', true);
+ expect(fileList.$el.hasClass('hide-hidden-files')).toEqual(false);
+ });
+ });
describe('Removing files from the list', function() {
it('Removes file from list when calling remove() and updates summary', function() {
var $summary;