Add buttons for switching JSON preview style

This commit is contained in:
2018-01-06 12:53:14 +00:00
parent 3c9bf3f322
commit a832f5614c
5 changed files with 77 additions and 4 deletions

View File

@@ -4,8 +4,45 @@ moduleFor('controller:inspect', 'Unit | Controller | inspect', {
needs: ['controller:application', 'service:storage']
});
// Replace this with your real tests.
test('it exists', function(assert) {
test('#documentIsJSON', function(assert) {
let controller = this.subject();
assert.ok(controller);
controller.set('model', {});
controller.set('model.documentMetaData', {
"name": "869575AF-84AE-49B3-8752-5782E9CA2BC5",
"type": "application/json",
"isBinary": false,
"isFolder": false,
"size": 202,
"path": "/documents/notes/869575AF-84AE-49B3-8752-5782E9CA2BC5",
"etag": "776662336"
});
assert.ok(controller.get('documentIsJSON'), 'is true when content type is JSON');
controller.set('model.documentMetaData', {
"name": "171127-1708-32c3.png",
"type": "image/png",
"isBinary": true,
"isFolder": false,
"size": 42624,
"path": "public/shares/171127-1708-32c3.png",
"etag": "894001114"
});
assert.notOk(controller.get('documentIsJSON'), 'is false when content type is not JSON');
});
test('jsonView actions/methods', function(assert) {
let controller = this.subject();
controller.set('jsonView', null);
controller.send('showJsonTree');
assert.ok(controller.get('jsonShowTree'));
assert.notOk(controller.get('jsonShowSource'));
controller.send('showJsonSource');
assert.ok(controller.get('jsonShowSource'));
assert.notOk(controller.get('jsonShowTree'));
});