diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2015-02-12 16:49:31 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2015-02-12 16:50:14 +0100 |
commit | e952687dcdd5d5da7f081a7b1fea38fb9937d259 (patch) | |
tree | d65e2f4834acac95645e9e989345fc02fc07f1e2 /core/js/tests | |
parent | 47b96c9fa1449509c11a5a22589d67a6b1138d20 (diff) | |
download | nextcloud-server-e952687dcdd5d5da7f081a7b1fea38fb9937d259.tar.gz nextcloud-server-e952687dcdd5d5da7f081a7b1fea38fb9937d259.zip |
Added unit test
Diffstat (limited to 'core/js/tests')
-rw-r--r-- | core/js/tests/specs/shareSpec.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/core/js/tests/specs/shareSpec.js b/core/js/tests/specs/shareSpec.js index 7eb22261e10..21d93d4a4b0 100644 --- a/core/js/tests/specs/shareSpec.js +++ b/core/js/tests/specs/shareSpec.js @@ -26,6 +26,7 @@ describe('OC.Share tests', function() { var oldAppConfig; var loadItemStub; var autocompleteStub; + var avatarStub; beforeEach(function() { $('#testArea').append($('<div id="shareContainer"></div>')); @@ -54,6 +55,8 @@ describe('OC.Share tests', function() { var $el = $('<div></div>').data('ui-autocomplete', {}); return $el; }); + + avatarStub = sinon.stub($.fn, 'avatar'); }); afterEach(function() { /* jshint camelcase:false */ @@ -61,6 +64,7 @@ describe('OC.Share tests', function() { loadItemStub.restore(); autocompleteStub.restore(); + avatarStub.restore(); $('#dropdown').remove(); }); it('calls loadItem with the correct arguments', function() { @@ -405,6 +409,37 @@ describe('OC.Share tests', function() { }); }); }); + describe('check for avatar', function() { + beforeEach(function() { + loadItemStub.returns({ + reshare: [], + shares: [{ + id: 100, + item_source: 123, + permissions: 31, + share_type: OC.Share.SHARE_TYPE_USER, + share_with: 'user1', + share_with_displayname: 'User One' + }] + }); + OC.Share.showDropDown( + 'file', + 123, + $container, + true, + 31, + 'shared_file_name.txt' + ); + }); + it('test correct function call', function() { + expect(avatarStub.calledOnce).toEqual(true); + var args = avatarStub.getCall(0).args; + + expect($('#avatar-user1')[0]).toEqual(jasmine.anything()); + expect(args.length).toEqual(2); + expect(args[0]).toEqual('user1'); + }); + }); describe('"sharesChanged" event', function() { var autocompleteOptions; var handler; |