-
-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit-tests for fileRemove event.
- Loading branch information
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
describe('fileRemoved event', function() { | ||
/** | ||
* @type {Flow} | ||
*/ | ||
var flow; | ||
|
||
beforeEach(function () { | ||
flow = new Flow({ | ||
generateUniqueIdentifier: function (file) { | ||
return file.size; | ||
} | ||
}); | ||
}); | ||
|
||
it('should call fileRemoved event on Flow.removeFile', function() { | ||
var valid = false; | ||
var removedFile = null; | ||
flow.on('fileRemoved', function (file) { | ||
expect(file.file instanceof Blob).toBeTruthy(); | ||
removedFile = file; | ||
valid = true; | ||
}); | ||
flow.addFile(new Blob(['file part'])); | ||
var addedFile = flow.files[0]; | ||
flow.removeFile(addedFile); | ||
expect(removedFile).toBe(addedFile); | ||
expect(valid).toBeTruthy(); | ||
}); | ||
|
||
it('should call fileRemoved event FlowFile.cancel', function() { | ||
var valid = false; | ||
var removedFile = null; | ||
flow.on('fileRemoved', function (file) { | ||
expect(file.file instanceof Blob).toBeTruthy(); | ||
removedFile = file; | ||
valid = true; | ||
}); | ||
flow.addFile(new Blob(['file part'])); | ||
var addedFile = flow.files[0]; | ||
addedFile.cancel(); | ||
expect(removedFile).toBe(addedFile); | ||
expect(valid).toBeTruthy(); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters