의 미러
https://github.com/nextcloud/server.git
synced 2024-08-27 05:55:24 +02:00
Fix unit tests
This commit is contained in:
부모
f99fcd5dd6
커밋
49031e0744
@ -129,7 +129,7 @@
|
||||
$loading.addClass('hidden');
|
||||
$loading.removeClass('inlineblock');
|
||||
if (result.ocs.meta.statuscode == 100) {
|
||||
var users = [].concat(result.ocs.data.exact.users).concat(result.ocs.data.users);
|
||||
var users = result.ocs.data.exact.users.concat(result.ocs.data.users);
|
||||
var groups = result.ocs.data.exact.groups.concat(result.ocs.data.groups);
|
||||
var remotes = result.ocs.data.exact.remotes.concat(result.ocs.data.remotes);
|
||||
|
||||
@ -195,8 +195,12 @@
|
||||
|
||||
var suggestions = users.concat(groups).concat(remotes);
|
||||
|
||||
$('.shareWithField').autocomplete("option", "autoFocus", true);
|
||||
response(suggestions);
|
||||
if (suggestions.length > 0) {
|
||||
$('.shareWithField').autocomplete("option", "autoFocus", true);
|
||||
response(suggestions);
|
||||
} else {
|
||||
response();
|
||||
}
|
||||
} else {
|
||||
response();
|
||||
}
|
||||
|
@ -724,15 +724,30 @@ describe('OC.Share.ShareDialogView', function() {
|
||||
var response = sinon.stub();
|
||||
dialog.autocompleteHandler({term: 'bob'}, response);
|
||||
var jsonData = JSON.stringify({
|
||||
"data": [{"label": "bob", "value": {"shareType": 0, "shareWith": "test"}}],
|
||||
"status": "success"
|
||||
'ocs' : {
|
||||
'meta' : {
|
||||
'status' : 'success',
|
||||
'statuscode' : 100,
|
||||
'message' : null
|
||||
},
|
||||
'data' : {
|
||||
'exact' : {
|
||||
'users' : [],
|
||||
'groups' : [],
|
||||
'remotes': []
|
||||
},
|
||||
'users' : [{'label': 'bob', 'value': {'shareType': 0, 'shareWith': 'test'}}],
|
||||
'groups' : [],
|
||||
'remotes': []
|
||||
}
|
||||
}
|
||||
});
|
||||
fakeServer.requests[0].respond(
|
||||
200,
|
||||
{'Content-Type': 'application/json'},
|
||||
jsonData
|
||||
);
|
||||
expect(response.calledWithExactly(JSON.parse(jsonData).data)).toEqual(true);
|
||||
expect(response.calledWithExactly(JSON.parse(jsonData).ocs.data.users)).toEqual(true);
|
||||
expect(autocompleteStub.calledWith("option", "autoFocus", true)).toEqual(true);
|
||||
});
|
||||
|
||||
@ -740,7 +755,14 @@ describe('OC.Share.ShareDialogView', function() {
|
||||
dialog.render();
|
||||
var response = sinon.stub();
|
||||
dialog.autocompleteHandler({term: 'bob'}, response);
|
||||
var jsonData = JSON.stringify({"status": "failure"});
|
||||
var jsonData = JSON.stringify({
|
||||
'ocs' : {
|
||||
'meta' : {
|
||||
'status': 'failure',
|
||||
'statuscode': 400
|
||||
}
|
||||
}
|
||||
});
|
||||
fakeServer.requests[0].respond(
|
||||
200,
|
||||
{'Content-Type': 'application/json'},
|
||||
|
불러오는 중...
Reference in New Issue
Block a user