diff options
Diffstat (limited to 'apps/files/tests/js/filelistSpec.js')
-rw-r--r-- | apps/files/tests/js/filelistSpec.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js index a83c8c4c0bc..cc3bcd74b46 100644 --- a/apps/files/tests/js/filelistSpec.js +++ b/apps/files/tests/js/filelistSpec.js @@ -2106,6 +2106,8 @@ describe('OCA.Files.FileList tests', function() { it('Toggles the sort indicator when clicking on a column header', function() { var ASC_CLASS = fileList.SORT_INDICATOR_ASC_CLASS; var DESC_CLASS = fileList.SORT_INDICATOR_DESC_CLASS; + var request; + var sortingUrl = OC.generateUrl('/apps/files/api/v1/sorting'); fileList.$el.find('.column-size .columntitle').click(); // moves triangle to size column, check indicator on name is hidden expect( @@ -2118,6 +2120,10 @@ describe('OCA.Files.FileList tests', function() { expect( fileList.$el.find('.column-size .sort-indicator').hasClass(DESC_CLASS) ).toEqual(true); + // check if changes are persisted + expect(fakeServer.requests.length).toEqual(1); + request = fakeServer.requests[0]; + expect(request.url).toEqual(sortingUrl); // click again on size column, reverses direction fileList.$el.find('.column-size .columntitle').click(); @@ -2127,6 +2133,10 @@ describe('OCA.Files.FileList tests', function() { expect( fileList.$el.find('.column-size .sort-indicator').hasClass(ASC_CLASS) ).toEqual(true); + // check if changes are persisted + expect(fakeServer.requests.length).toEqual(2); + request = fakeServer.requests[1]; + expect(request.url).toEqual(sortingUrl); // click again on size column, reverses direction fileList.$el.find('.column-size .columntitle').click(); @@ -2136,6 +2146,9 @@ describe('OCA.Files.FileList tests', function() { expect( fileList.$el.find('.column-size .sort-indicator').hasClass(DESC_CLASS) ).toEqual(true); + expect(fakeServer.requests.length).toEqual(3); + request = fakeServer.requests[2]; + expect(request.url).toEqual(sortingUrl); // click on mtime column, moves indicator there fileList.$el.find('.column-mtime .columntitle').click(); @@ -2148,6 +2161,9 @@ describe('OCA.Files.FileList tests', function() { expect( fileList.$el.find('.column-mtime .sort-indicator').hasClass(DESC_CLASS) ).toEqual(true); + expect(fakeServer.requests.length).toEqual(4); + request = fakeServer.requests[3]; + expect(request.url).toEqual(sortingUrl); }); it('Uses correct sort comparator when inserting files', function() { testFiles.sort(OCA.Files.FileList.Comparators.size); |