summaryrefslogtreecommitdiffstats
path: root/apps/files_versions/tests/js/versionstabviewSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_versions/tests/js/versionstabviewSpec.js')
-rw-r--r--apps/files_versions/tests/js/versionstabviewSpec.js62
1 files changed, 0 insertions, 62 deletions
diff --git a/apps/files_versions/tests/js/versionstabviewSpec.js b/apps/files_versions/tests/js/versionstabviewSpec.js
index 94ad72d0f77..40fd8879645 100644
--- a/apps/files_versions/tests/js/versionstabviewSpec.js
+++ b/apps/files_versions/tests/js/versionstabviewSpec.js
@@ -82,14 +82,12 @@ describe('OCA.Versions.VersionsTabView', function() {
expect($item.find('.versiondate').text()).toEqual('seconds ago');
expect($item.find('.size').text()).toEqual('< 1 KB');
expect($item.find('.revertVersion').length).toEqual(1);
- expect($item.find('.preview').attr('src')).toEqual('http://localhost/core/img/filetypes/text.svg');
$item = $versions.eq(1);
expect($item.find('.downloadVersion').attr('href')).toEqual(version2.getDownloadUrl());
expect($item.find('.versiondate').text()).toEqual('2 days ago');
expect($item.find('.size').text()).toEqual('< 1 KB');
expect($item.find('.revertVersion').length).toEqual(1);
- expect($item.find('.preview').attr('src')).toEqual('http://localhost/core/img/filetypes/text.svg');
});
it('does not render revert button when no update permissions', function() {
@@ -106,71 +104,11 @@ describe('OCA.Versions.VersionsTabView', function() {
expect($item.find('.downloadVersion').attr('href')).toEqual(version1.getDownloadUrl());
expect($item.find('.versiondate').text()).toEqual('seconds ago');
expect($item.find('.revertVersion').length).toEqual(0);
- expect($item.find('.preview').attr('src')).toEqual('http://localhost/core/img/filetypes/text.svg');
$item = $versions.eq(1);
expect($item.find('.downloadVersion').attr('href')).toEqual(version2.getDownloadUrl());
expect($item.find('.versiondate').text()).toEqual('2 days ago');
expect($item.find('.revertVersion').length).toEqual(0);
- expect($item.find('.preview').attr('src')).toEqual('http://localhost/core/img/filetypes/text.svg');
- });
- });
-
- describe('More versions', function() {
- var hasMoreResultsStub;
-
- beforeEach(function() {
- tabView.setFileInfo(fileInfoModel);
- fetchStub.reset();
- tabView.collection.set(testVersions);
- hasMoreResultsStub = sinon.stub(VersionCollection.prototype, 'hasMoreResults');
- });
- afterEach(function() {
- hasMoreResultsStub.restore();
- });
-
- it('shows "More versions" button when more versions are available', function() {
- hasMoreResultsStub.returns(true);
- tabView.collection.trigger('sync');
-
- expect(tabView.$el.find('.showMoreVersions').hasClass('hidden')).toEqual(false);
- });
- it('does not show "More versions" button when more versions are available', function() {
- hasMoreResultsStub.returns(false);
- tabView.collection.trigger('sync');
-
- expect(tabView.$el.find('.showMoreVersions').hasClass('hidden')).toEqual(true);
- });
- it('fetches and appends the next page when clicking the "More" button', function() {
- hasMoreResultsStub.returns(true);
-
- expect(fetchStub.notCalled).toEqual(true);
-
- tabView.$el.find('.showMoreVersions').click();
-
- expect(fetchStub.calledOnce).toEqual(true);
- });
- it('appends version to the list when added to collection', function() {
- var time3 = Date.UTC(2015, 6, 10, 1, 0, 0, 0) / 1000;
-
- var version3 = new VersionModel({
- id: time3,
- timestamp: time3,
- name: 'some file.txt',
- size: 54,
- fullPath: '/subdir/some file.txt',
- mimetype: 'text/plain'
- });
-
- tabView.collection.add(version3);
-
- expect(tabView.$el.find('.versions>li').length).toEqual(3);
-
- var $item = tabView.$el.find('.versions>li').eq(2);
- expect($item.find('.downloadVersion').attr('href')).toEqual(version3.getDownloadUrl());
- expect($item.find('.versiondate').text()).toEqual('7 days ago');
- expect($item.find('.revertVersion').length).toEqual(1);
- expect($item.find('.preview').attr('src')).toEqual('http://localhost/core/img/filetypes/text.svg');
});
});