From 310d79728447ecf69f18d0b61a527397bd961888 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Tue, 1 Sep 2015 19:29:55 +0200 Subject: Add versions tab to files sidebar - move versions to a tab in the files sidebar - added mechanism to auto-update the row in the FileList whenever values are set to the FileInfoModel given to the sidebar - updated tags/favorite action to make use of that new mechanism --- apps/files/tests/js/tagspluginspec.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'apps/files/tests') diff --git a/apps/files/tests/js/tagspluginspec.js b/apps/files/tests/js/tagspluginspec.js index 950fb754253..533aa63362c 100644 --- a/apps/files/tests/js/tagspluginspec.js +++ b/apps/files/tests/js/tagspluginspec.js @@ -79,12 +79,12 @@ describe('OCA.Files.TagsPlugin tests', function() { it('sends request to server and updates icon', function() { var request; fileList.setFiles(testFiles); - $tr = fileList.$el.find('tbody tr:first'); - $action = $tr.find('.action-favorite'); + var $tr = fileList.findFileEl('One.txt'); + var $action = $tr.find('.action-favorite'); $action.click(); expect(fakeServer.requests.length).toEqual(1); - var request = fakeServer.requests[0]; + request = fakeServer.requests[0]; expect(JSON.parse(request.requestBody)).toEqual({ tags: ['tag1', 'tag2', OC.TAG_FAVORITE] }); @@ -92,12 +92,18 @@ describe('OCA.Files.TagsPlugin tests', function() { tags: ['tag1', 'tag2', 'tag3', OC.TAG_FAVORITE] })); + // re-read the element as it was re-inserted + $tr = fileList.findFileEl('One.txt'); + $action = $tr.find('.action-favorite'); + expect($tr.attr('data-favorite')).toEqual('true'); expect($tr.attr('data-tags').split('|')).toEqual(['tag1', 'tag2', 'tag3', OC.TAG_FAVORITE]); expect(fileList.files[0].tags).toEqual(['tag1', 'tag2', 'tag3', OC.TAG_FAVORITE]); expect($action.find('img').attr('src')).toEqual(OC.imagePath('core', 'actions/starred')); $action.click(); + + expect(fakeServer.requests.length).toEqual(2); request = fakeServer.requests[1]; expect(JSON.parse(request.requestBody)).toEqual({ tags: ['tag1', 'tag2', 'tag3'] @@ -106,7 +112,11 @@ describe('OCA.Files.TagsPlugin tests', function() { tags: ['tag1', 'tag2', 'tag3'] })); - expect($tr.attr('data-favorite')).toEqual('false'); + // re-read the element as it was re-inserted + $tr = fileList.findFileEl('One.txt'); + $action = $tr.find('.action-favorite'); + + expect($tr.attr('data-favorite')).toBeFalsy(); expect($tr.attr('data-tags').split('|')).toEqual(['tag1', 'tag2', 'tag3']); expect(fileList.files[0].tags).toEqual(['tag1', 'tag2', 'tag3']); expect($action.find('img').attr('src')).toEqual(OC.imagePath('core', 'actions/star')); -- cgit v1.2.3