Move adding test files to "beforeEach()"
All the tests in the "Renaming files" section added the test files, although those calling "doRename()" added them by setting a path for the file too. However, the path is ignored in the other tests, so adding the files can be unified and moved to "beforeEach()". This would be needed, for example, to show the details view for a file before calling "doRename()". Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
1fb3e38574
commit
65bba286b6
|
@ -589,6 +589,12 @@ describe('OCA.Files.FileList tests', function() {
|
|||
beforeEach(function() {
|
||||
deferredRename = $.Deferred();
|
||||
renameStub = sinon.stub(filesClient, 'move').returns(deferredRename.promise());
|
||||
|
||||
for (var i = 0; i < testFiles.length; i++) {
|
||||
var file = testFiles[i];
|
||||
file.path = '/some/subdir';
|
||||
fileList.add(file, {silent: true});
|
||||
}
|
||||
});
|
||||
afterEach(function() {
|
||||
renameStub.restore();
|
||||
|
@ -596,9 +602,6 @@ describe('OCA.Files.FileList tests', function() {
|
|||
|
||||
function doCancelRename() {
|
||||
var $input;
|
||||
for (var i = 0; i < testFiles.length; i++) {
|
||||
fileList.add(testFiles[i]);
|
||||
}
|
||||
|
||||
// trigger rename prompt
|
||||
fileList.rename('One.txt');
|
||||
|
@ -613,12 +616,6 @@ describe('OCA.Files.FileList tests', function() {
|
|||
function doRename() {
|
||||
var $input;
|
||||
|
||||
for (var i = 0; i < testFiles.length; i++) {
|
||||
var file = testFiles[i];
|
||||
file.path = '/some/subdir';
|
||||
fileList.add(file, {silent: true});
|
||||
}
|
||||
|
||||
// trigger rename prompt
|
||||
fileList.rename('One.txt');
|
||||
$input = fileList.$fileList.find('input.filename');
|
||||
|
@ -708,10 +705,6 @@ describe('OCA.Files.FileList tests', function() {
|
|||
it('Validates the file name', function() {
|
||||
var $input, $tr;
|
||||
|
||||
for (var i = 0; i < testFiles.length; i++) {
|
||||
fileList.add(testFiles[i], {silent: true});
|
||||
}
|
||||
|
||||
// trigger rename prompt
|
||||
fileList.rename('One.txt');
|
||||
$input = fileList.$fileList.find('input.filename');
|
||||
|
|
Loading…
Reference in New Issue