Skip to content

Commit

Permalink
Merge pull request #27703 from owncloud/filelist-refreshonswitch
Browse files Browse the repository at this point in the history
Reload file list when leaving hidden state
  • Loading branch information
Vincent Petry committed Apr 20, 2017
2 parents cde1b0c + 8924d84 commit 631af7a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apps/files/js/filelist.js
Expand Up @@ -322,6 +322,7 @@
this.$fileList.on('click','td.filename>a.name, td.filesize, td.date', _.bind(this._onClickFile, this));

this.$fileList.on('change', 'td.filename>.selectCheckBox', _.bind(this._onClickFileCheckbox, this));
this.$el.on('show', _.bind(this._onShow, this));
this.$el.on('urlChanged', _.bind(this._onUrlChanged, this));
this.$el.find('.select-all').click(_.bind(this._onClickSelectAll, this));
this.$el.find('.download').click(_.bind(this._onClickDownloadSelected, this));
Expand Down Expand Up @@ -544,6 +545,13 @@
this.$table.find('>thead').width($('#app-content').width() - OC.Util.getScrollBarWidth());
},

/**
* Event handler when leaving previously hidden state
*/
_onShow: function(e) {
this.reload();
},

/**
* Event handler for when the URL changed
*/
Expand Down
6 changes: 6 additions & 0 deletions apps/files/tests/js/filelistSpec.js
Expand Up @@ -1501,6 +1501,12 @@ describe('OCA.Files.FileList tests', function() {
$('#app-content-files').trigger(new $.Event('urlChanged', {view: 'files', dir: '/somedir'}));
expect(fileList.getCurrentDirectory()).toEqual('/somedir');
});
it('reloads the list when leaving hidden state', function() {
var reloadStub = sinon.stub(fileList, 'reload');
$('#app-content-files').trigger(new $.Event('show'));
expect(reloadStub.calledOnce).toEqual(true);
reloadStub.restore();
});
it('refreshes breadcrumb after update', function() {
var setDirSpy = sinon.spy(fileList.breadcrumb, 'setDirectory');
fileList.changeDirectory('/anothersubdir');
Expand Down

0 comments on commit 631af7a

Please sign in to comment.