@@ -26,6 +26,7 @@ describe('OC.Share tests', function() {
2626 var oldAppConfig ;
2727 var loadItemStub ;
2828 var autocompleteStub ;
29+ var avatarStub ;
2930
3031 beforeEach ( function ( ) {
3132 $ ( '#testArea' ) . append ( $ ( '<div id="shareContainer"></div>' ) ) ;
@@ -54,13 +55,16 @@ describe('OC.Share tests', function() {
5455 var $el = $ ( '<div></div>' ) . data ( 'ui-autocomplete' , { } ) ;
5556 return $el ;
5657 } ) ;
58+
59+ avatarStub = sinon . stub ( $ . fn , 'avatar' ) ;
5760 } ) ;
5861 afterEach ( function ( ) {
5962 /* jshint camelcase:false */
6063 oc_appconfig . core = oldAppConfig ;
6164 loadItemStub . restore ( ) ;
6265
6366 autocompleteStub . restore ( ) ;
67+ avatarStub . restore ( ) ;
6468 $ ( '#dropdown' ) . remove ( ) ;
6569 } ) ;
6670 it ( 'calls loadItem with the correct arguments' , function ( ) {
@@ -405,6 +409,37 @@ describe('OC.Share tests', function() {
405409 } ) ;
406410 } ) ;
407411 } ) ;
412+ describe ( 'check for avatar' , function ( ) {
413+ beforeEach ( function ( ) {
414+ loadItemStub . returns ( {
415+ reshare : [ ] ,
416+ shares : [ {
417+ id : 100 ,
418+ item_source : 123 ,
419+ permissions : 31 ,
420+ share_type : OC . Share . SHARE_TYPE_USER ,
421+ share_with : 'user1' ,
422+ share_with_displayname : 'User One'
423+ } ]
424+ } ) ;
425+ OC . Share . showDropDown (
426+ 'file' ,
427+ 123 ,
428+ $container ,
429+ true ,
430+ 31 ,
431+ 'shared_file_name.txt'
432+ ) ;
433+ } ) ;
434+ it ( 'test correct function call' , function ( ) {
435+ expect ( avatarStub . calledOnce ) . toEqual ( true ) ;
436+ var args = avatarStub . getCall ( 0 ) . args ;
437+
438+ expect ( $ ( '#avatar-user1' ) [ 0 ] ) . toEqual ( jasmine . anything ( ) ) ;
439+ expect ( args . length ) . toEqual ( 2 ) ;
440+ expect ( args [ 0 ] ) . toEqual ( 'user1' ) ;
441+ } ) ;
442+ } ) ;
408443 describe ( '"sharesChanged" event' , function ( ) {
409444 var autocompleteOptions ;
410445 var handler ;
0 commit comments