Commit 7804d044 authored by Thomas Müller's avatar Thomas Müller
Browse files

Merge pull request #15206 from owncloud/mark-dot-files-gray

Show hidden files (dot files) in gray
parents 69f14f97 92f0dba3
......@@ -743,8 +743,12 @@
// from here work on the display name
name = fileData.displayName || name;
// show hidden files (starting with a dot) completely in gray
if(name.indexOf('.') === 0) {
basename = '';
extension = name;
// split extension from filename for non dirs
if (type !== 'dir' && name.indexOf('.') !== -1) {
} else if (type !== 'dir' && name.indexOf('.') !== -1) {
basename = name.substr(0, name.lastIndexOf('.'));
extension = name.substr(name.lastIndexOf('.'));
} else {
......
......@@ -359,6 +359,25 @@ describe('OCA.Files.FileList tests', function() {
expect($('#emptycontent').hasClass('hidden')).toEqual(true);
expect(fileList.isEmpty).toEqual(false);
});
it('correctly adds the extension markup and show hidden files completely in gray', function() {
var $tr;
var testDataAndExpectedResult = [
{file: {type: 'file', name: 'ZZZ.txt'}, extension: '.txt'},
{file: {type: 'file', name: 'ZZZ.tar.gz'}, extension: '.gz'},
{file: {type: 'file', name: 'test.with.some.dots.in.it.txt'}, extension: '.txt'},
// we render hidden files completely in gray
{file: {type: 'file', name: '.test.with.some.dots.in.it.txt'}, extension: '.test.with.some.dots.in.it.txt'},
{file: {type: 'file', name: '.hidden'}, extension: '.hidden'},
];
fileList.setFiles(testFiles);
for(var i = 0; i < testDataAndExpectedResult.length; i++) {
var testSet = testDataAndExpectedResult[i];
var fileData = testSet['file'];
$tr = fileList.add(fileData);
expect($tr.find('.nametext .extension').text()).toEqual(testSet['extension']);
}
});
});
describe('Removing files from the list', function() {
it('Removes file from list when calling remove() and updates summary', function() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment