diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-09-01 19:29:55 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-09-03 16:47:24 +0200 |
commit | 310d79728447ecf69f18d0b61a527397bd961888 (patch) | |
tree | 805b2a0a40ed5ce7acb58afb90ad7c18e760e037 /apps/files/tests/js | |
parent | e9e42fff61a922f11a3b1014d810562537950b6a (diff) | |
download | nextcloud-server-310d79728447ecf69f18d0b61a527397bd961888.tar.gz nextcloud-server-310d79728447ecf69f18d0b61a527397bd961888.zip |
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
Diffstat (limited to 'apps/files/tests/js')
-rw-r--r-- | apps/files/tests/js/tagspluginspec.js | 18 |
1 files changed, 14 insertions, 4 deletions
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')); |