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
00a823f62e
commit
7a088cfcf5
1 changed files with 6 additions and 13 deletions
|
@ -612,6 +612,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();
|
||||
|
@ -619,9 +625,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');
|
||||
|
@ -636,12 +639,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');
|
||||
|
@ -731,10 +728,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});
|
||||
}
|
||||
|
||||
$tr = fileList.findFileEl('One.txt');
|
||||
expect($tr.find('a.name').css('display')).not.toEqual('none');
|
||||
|
||||
|
|
Loading…
Reference in a new issue