Delete all documents in current directory
Adds a new button to the top right for deleting all documents in a directory.
This commit is contained in:
@@ -4,8 +4,89 @@ moduleFor('controller:index', 'Unit | Controller | index', {
|
||||
needs: ['controller:application', 'service:storage']
|
||||
});
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
test('#parentDir', function(assert) {
|
||||
let controller = this.subject();
|
||||
assert.ok(controller);
|
||||
controller.set('currentDirPath', 'islands/spain/canaries/tenerife/');
|
||||
|
||||
assert.equal(controller.get('parentDir'), 'islands/spain/canaries/');
|
||||
});
|
||||
|
||||
test('#currentListingContainsDocuments', function(assert) {
|
||||
let controller = this.subject();
|
||||
|
||||
controller.set('currentListing', [
|
||||
{
|
||||
"name": "spain/",
|
||||
"type": "folder",
|
||||
"isBinary": false,
|
||||
"isFolder": true,
|
||||
"size": null,
|
||||
"path": "/islands/spain/",
|
||||
"etag": "885098000"
|
||||
}
|
||||
]);
|
||||
|
||||
assert.notOk(controller.get('currentListingContainsDocuments'),
|
||||
'returns false when no documents are present');
|
||||
|
||||
controller.set('currentListing', [
|
||||
{
|
||||
"name": "spain/",
|
||||
"type": "folder",
|
||||
"isBinary": false,
|
||||
"isFolder": true,
|
||||
"size": null,
|
||||
"path": "/islands/spain/",
|
||||
"etag": "885098000"
|
||||
},
|
||||
{
|
||||
"name": "lamu",
|
||||
"type": "application/json",
|
||||
"isBinary": false,
|
||||
"isFolder": false,
|
||||
"size": 202,
|
||||
"path": "/islands/lamu",
|
||||
"etag": "478058546"
|
||||
}
|
||||
]);
|
||||
|
||||
assert.ok(controller.get('currentListingContainsDocuments'),
|
||||
'returns true when no documents are present');
|
||||
});
|
||||
|
||||
test('#documentCount', function(assert) {
|
||||
let controller = this.subject();
|
||||
|
||||
controller.set('currentListing', [
|
||||
{
|
||||
"name": "spain/",
|
||||
"type": "folder",
|
||||
"isBinary": false,
|
||||
"isFolder": true,
|
||||
"size": null,
|
||||
"path": "/islands/spain/",
|
||||
"etag": "885098000"
|
||||
},
|
||||
{
|
||||
"name": "lamu",
|
||||
"type": "application/json",
|
||||
"isBinary": false,
|
||||
"isFolder": false,
|
||||
"size": 202,
|
||||
"path": "/islands/lamu",
|
||||
"etag": "478058546"
|
||||
},
|
||||
{
|
||||
"name": "dominica",
|
||||
"type": "application/json",
|
||||
"isBinary": false,
|
||||
"isFolder": false,
|
||||
"size": 202,
|
||||
"path": "/islands/dominica",
|
||||
"etag": "929838541"
|
||||
}
|
||||
]);
|
||||
|
||||
assert.equal(controller.get('documentCount'), 2,
|
||||
'returns the number of documents in the current listing');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user