|
|
|
@ -956,9 +956,12 @@ describe('OC.Share.ShareDialogView', function() { |
|
|
|
|
|
|
|
|
|
it('calls addShare after selection', function() { |
|
|
|
|
dialog.render(); |
|
|
|
|
|
|
|
|
|
var shareWith = $('.shareWithField')[0]; |
|
|
|
|
var $shareWith = $(shareWith); |
|
|
|
|
var addShareStub = sinon.stub(shareModel, 'addShare'); |
|
|
|
|
var autocompleteOptions = autocompleteStub.getCall(0).args[0]; |
|
|
|
|
autocompleteOptions.select(new $.Event('select'), { |
|
|
|
|
autocompleteOptions.select(new $.Event('select', {target: shareWith}), { |
|
|
|
|
item: { |
|
|
|
|
label: 'User Two', |
|
|
|
|
value: { |
|
|
|
@ -974,6 +977,17 @@ describe('OC.Share.ShareDialogView', function() { |
|
|
|
|
shareWith: 'user2' |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
//Input is locked
|
|
|
|
|
expect($shareWith.val()).toEqual('User Two'); |
|
|
|
|
expect($shareWith.attr('disabled')).toEqual('disabled'); |
|
|
|
|
|
|
|
|
|
//Callback is called
|
|
|
|
|
addShareStub.firstCall.args[1].success(); |
|
|
|
|
|
|
|
|
|
//Input is unlocked
|
|
|
|
|
expect($shareWith.val()).toEqual(''); |
|
|
|
|
expect($shareWith.attr('disabled')).toEqual(undefined); |
|
|
|
|
|
|
|
|
|
addShareStub.restore(); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|