Updated unit tests

This commit is contained in:
Roeland Jago Douma 2016-02-12 14:31:00 +01:00
parent 51b55d5320
commit 92c131b481
1 changed files with 15 additions and 1 deletions

View File

@ -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();
});
});