diff options
Diffstat (limited to 'apps/files/tests/js/fileUploadSpec.js')
-rw-r--r-- | apps/files/tests/js/fileUploadSpec.js | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/apps/files/tests/js/fileUploadSpec.js b/apps/files/tests/js/fileUploadSpec.js index 817654c4fa9..cad8468d1c8 100644 --- a/apps/files/tests/js/fileUploadSpec.js +++ b/apps/files/tests/js/fileUploadSpec.js @@ -19,7 +19,6 @@ * */ -/* global OC */ describe('OC.Upload tests', function() { var $dummyUploader; var testFile; @@ -118,54 +117,4 @@ describe('OC.Upload tests', function() { ); }); }); - describe('New file', function() { - var $input; - var currentDirStub; - - beforeEach(function() { - OC.Upload.init(); - $('#new>a').click(); - $('#new li[data-type=file]').click(); - $input = $('#new input[type=text]'); - - currentDirStub = sinon.stub(FileList, 'getCurrentDirectory'); - currentDirStub.returns('testdir'); - }); - afterEach(function() { - currentDirStub.restore(); - }); - it('sets default text in field', function() { - expect($input.length).toEqual(1); - expect($input.val()).toEqual('New text file.txt'); - }); - it('creates file when enter is pressed', function() { - $input.val('somefile.txt'); - $input.trigger(new $.Event('keyup', {keyCode: 13})); - $input.parent('form').submit(); - expect(fakeServer.requests.length).toEqual(2); - - var request = fakeServer.requests[1]; - expect(request.method).toEqual('POST'); - expect(request.url).toEqual(OC.webroot + '/index.php/apps/files/ajax/newfile.php'); - var query = OC.parseQueryString(request.requestBody); - expect(query).toEqual({ - dir: 'testdir', - filename: 'somefile.txt' - }); - }); - it('prevents entering invalid file names', function() { - $input.val('..'); - $input.trigger(new $.Event('keyup', {keyCode: 13})); - $input.parent('form').submit(); - expect(fakeServer.requests.length).toEqual(1); - }); - it('prevents entering file names that already exist', function() { - var inListStub = sinon.stub(FileList, 'inList').returns(true); - $input.val('existing.txt'); - $input.trigger(new $.Event('keyup', {keyCode: 13})); - $input.parent('form').submit(); - expect(fakeServer.requests.length).toEqual(1); - inListStub.restore(); - }); - }); }); |