summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2018-03-16 17:19:22 +0100
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-03-20 19:09:04 +0100
commit375eab9df3997480ae56eea233e6eec2c3fdf82c (patch)
treebb854bf9a44cf76716a908f74435e48b2fc5a8cd
parent6fef01c481bb436ed6811097d41ba260007fcf38 (diff)
downloadnextcloud-server-375eab9df3997480ae56eea233e6eec2c3fdf82c.tar.gz
nextcloud-server-375eab9df3997480ae56eea233e6eec2c3fdf82c.zip
Add tests for emails and circles already shared with
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
-rw-r--r--core/js/tests/specs/sharedialogviewSpec.js121
1 files changed, 120 insertions, 1 deletions
diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js
index c014dfc15d5..684c2bea45a 100644
--- a/core/js/tests/specs/sharedialogviewSpec.js
+++ b/core/js/tests/specs/sharedialogviewSpec.js
@@ -642,7 +642,20 @@ describe('OC.Share.ShareDialogView', function() {
share_type: OC.Share.SHARE_TYPE_REMOTE,
share_with: 'foo@bar.com/baz',
share_with_displayname: 'foo@bar.com/baz'
-
+ },{
+ id: 103,
+ item_source: 123,
+ permissions: 31,
+ share_type: OC.Share.SHARE_TYPE_EMAIL,
+ share_with: 'foo@bar.com',
+ share_with_displayname: 'foo@bar.com'
+ },{
+ id: 104,
+ item_source: 123,
+ permissions: 31,
+ share_type: OC.Share.SHARE_TYPE_CIRCLE,
+ share_with: 'shortId',
+ share_with_displayname: 'CircleName (type, owner)'
}]
});
});
@@ -799,6 +812,112 @@ describe('OC.Share.ShareDialogView', function() {
}])).toEqual(true);
expect(autocompleteStub.calledWith("option", "autoFocus", true)).toEqual(true);
});
+
+ it('emails', function () {
+ dialog.render();
+ var response = sinon.stub();
+ dialog.autocompleteHandler({term: 'foo'}, response);
+ var jsonData = JSON.stringify({
+ 'ocs': {
+ 'meta': {
+ 'status': 'success',
+ 'statuscode': 100,
+ 'message': null
+ },
+ 'data': {
+ 'exact': {
+ 'users': [],
+ 'groups': [],
+ 'remotes': [],
+ 'emails': []
+ },
+ 'users': [],
+ 'groups': [],
+ 'remotes': [],
+ 'lookup': [],
+ 'emails': [
+ {
+ 'label': 'foo@bar.com',
+ 'value': {
+ 'shareType': OC.Share.SHARE_TYPE_EMAIL,
+ 'shareWith': 'foo@bar.com'
+ }
+ },
+ {
+ 'label': 'foo2@bar.com',
+ 'value': {
+ 'shareType': OC.Share.SHARE_TYPE_EMAIL,
+ 'shareWith': 'foo2@bar.com'
+ }
+ }
+ ]
+ }
+ }
+ });
+ fakeServer.requests[0].respond(
+ 200,
+ {'Content-Type': 'application/json'},
+ jsonData
+ );
+ expect(response.calledWithExactly([{
+ 'label': 'foo2@bar.com',
+ 'value': {'shareType': OC.Share.SHARE_TYPE_EMAIL, 'shareWith': 'foo2@bar.com'}
+ }])).toEqual(true);
+ expect(autocompleteStub.calledWith("option", "autoFocus", true)).toEqual(true);
+ });
+
+ it('circles', function () {
+ dialog.render();
+ var response = sinon.stub();
+ dialog.autocompleteHandler({term: 'CircleNam'}, response);
+ var jsonData = JSON.stringify({
+ 'ocs': {
+ 'meta': {
+ 'status': 'success',
+ 'statuscode': 100,
+ 'message': null
+ },
+ 'data': {
+ 'exact': {
+ 'users': [],
+ 'groups': [],
+ 'remotes': [],
+ 'circles': []
+ },
+ 'users': [],
+ 'groups': [],
+ 'remotes': [],
+ 'lookup': [],
+ 'circles': [
+ {
+ 'label': 'CircleName (type, owner)',
+ 'value': {
+ 'shareType': OC.Share.SHARE_TYPE_CIRCLE,
+ 'shareWith': 'shortId'
+ }
+ },
+ {
+ 'label': 'CircleName (type2, owner)',
+ 'value': {
+ 'shareType': OC.Share.SHARE_TYPE_CIRCLE,
+ 'shareWith': 'shortId2'
+ }
+ }
+ ]
+ }
+ }
+ });
+ fakeServer.requests[0].respond(
+ 200,
+ {'Content-Type': 'application/json'},
+ jsonData
+ );
+ expect(response.calledWithExactly([{
+ 'label': 'CircleName (type2, owner)',
+ 'value': {'shareType': OC.Share.SHARE_TYPE_CIRCLE, 'shareWith': 'shortId2'}
+ }])).toEqual(true);
+ expect(autocompleteStub.calledWith("option", "autoFocus", true)).toEqual(true);
+ });
});
});