@@ -81,12 +81,12 @@ describe('OC.Share.ShareDialogLinkShareView', function () {
8181 // Needed to render the view
8282 configModel . isShareWithLinkAllowed . returns ( true ) ;
8383
84- // Setting the share also triggers the rendering
8584 shareModel . set ( {
86- linkShare : {
87- isLinkShare : true ,
88- }
85+ linkShares : [ {
86+ id : 123
87+ } ]
8988 } ) ;
89+ view . render ( ) ;
9090
9191 $hideDownloadCheckbox = view . $el . find ( '.hideDownloadCheckbox' ) ;
9292 $workingIcon = $hideDownloadCheckbox . prev ( '.icon-loading-small' ) ;
@@ -119,11 +119,12 @@ describe('OC.Share.ShareDialogLinkShareView', function () {
119119
120120 it ( 'checkbox is checked when the setting is enabled' , function ( ) {
121121 shareModel . set ( {
122- linkShare : {
123- isLinkShare : true ,
122+ linkShares : [ {
123+ id : 123 ,
124124 hideDownload : true
125- }
125+ } ]
126126 } ) ;
127+ view . render ( ) ;
127128
128129 $hideDownloadCheckbox = view . $el . find ( '.hideDownloadCheckbox' ) ;
129130
@@ -141,16 +142,17 @@ describe('OC.Share.ShareDialogLinkShareView', function () {
141142 $hideDownloadCheckbox . change ( ) ;
142143
143144 expect ( $workingIcon . hasClass ( 'hidden' ) ) . toBeFalsy ( ) ;
144- expect ( shareModel . saveLinkShare . withArgs ( { hideDownload : true } ) . calledOnce ) . toBeTruthy ( ) ;
145+ expect ( shareModel . saveLinkShare . withArgs ( { hideDownload : true , cid : 123 } ) . calledOnce ) . toBeTruthy ( ) ;
145146 } ) ;
146147
147148 it ( 'disables the setting if clicked when checked' , function ( ) {
148149 shareModel . set ( {
149- linkShare : {
150- isLinkShare : true ,
150+ linkShares : [ {
151+ id : 123 ,
151152 hideDownload : true
152- }
153+ } ]
153154 } ) ;
155+ view . render ( ) ;
154156
155157 $hideDownloadCheckbox = view . $el . find ( '.hideDownloadCheckbox' ) ;
156158 $workingIcon = $hideDownloadCheckbox . prev ( '.icon-loading-small' ) ;
@@ -161,7 +163,7 @@ describe('OC.Share.ShareDialogLinkShareView', function () {
161163 $hideDownloadCheckbox . change ( ) ;
162164
163165 expect ( $workingIcon . hasClass ( 'hidden' ) ) . toBeFalsy ( ) ;
164- expect ( shareModel . saveLinkShare . withArgs ( { hideDownload : false } ) . calledOnce ) . toBeTruthy ( ) ;
166+ expect ( shareModel . saveLinkShare . withArgs ( { hideDownload : false , cid : 123 } ) . calledOnce ) . toBeTruthy ( ) ;
165167 } ) ;
166168
167169 } ) ;
@@ -176,13 +178,13 @@ describe('OC.Share.ShareDialogLinkShareView', function () {
176178 // Needed to render the view
177179 configModel . isShareWithLinkAllowed . returns ( true ) ;
178180
179- // Setting the share also triggers the rendering
180181 shareModel . set ( {
181- linkShare : {
182- isLinkShare : true ,
182+ linkShares : [ {
183+ id : 123 ,
183184 password : 'password'
184- }
185+ } ]
185186 } ) ;
187+ view . render ( ) ;
186188
187189 var $passwordDiv = view . $el . find ( '#linkPass' ) ;
188190 $passwordText = view . $el . find ( '.linkPassText' ) ;
@@ -202,28 +204,28 @@ describe('OC.Share.ShareDialogLinkShareView', function () {
202204 } ) ;
203205
204206 it ( 'shows the working icon when called' , function ( ) {
205- view . onPasswordEntered ( ) ;
207+ view . onPasswordEntered ( { target : view . $el . find ( '.linkPassText' ) } ) ;
206208
207209 expect ( $workingIcon . hasClass ( 'hidden' ) ) . toBeFalsy ( ) ;
208- expect ( shareModel . saveLinkShare . withArgs ( { password : 'myPassword' } ) . calledOnce ) . toBeTruthy ( ) ;
210+ expect ( shareModel . saveLinkShare . withArgs ( { password : 'myPassword' , cid : 123 } ) . calledOnce ) . toBeTruthy ( ) ;
209211 } ) ;
210212
211213 it ( 'hides the working icon when saving the password succeeds' , function ( ) {
212- view . onPasswordEntered ( ) ;
214+ view . onPasswordEntered ( { target : view . $el . find ( '.linkPassText' ) } ) ;
213215
214216 expect ( $workingIcon . hasClass ( 'hidden' ) ) . toBeFalsy ( ) ;
215- expect ( shareModel . saveLinkShare . withArgs ( { password : 'myPassword' } ) . calledOnce ) . toBeTruthy ( ) ;
217+ expect ( shareModel . saveLinkShare . withArgs ( { password : 'myPassword' , cid : 123 } ) . calledOnce ) . toBeTruthy ( ) ;
216218
217219 shareModel . saveLinkShare . yieldTo ( "complete" , [ shareModel ] ) ;
218220
219221 expect ( $workingIcon . hasClass ( 'hidden' ) ) . toBeTruthy ( ) ;
220222 } ) ;
221223
222224 it ( 'hides the working icon when saving the password fails' , function ( ) {
223- view . onPasswordEntered ( ) ;
225+ view . onPasswordEntered ( { target : view . $el . find ( '.linkPassText' ) } ) ;
224226
225227 expect ( $workingIcon . hasClass ( 'hidden' ) ) . toBeFalsy ( ) ;
226- expect ( shareModel . saveLinkShare . withArgs ( { password : 'myPassword' } ) . calledOnce ) . toBeTruthy ( ) ;
228+ expect ( shareModel . saveLinkShare . withArgs ( { password : 'myPassword' , cid : 123 } ) . calledOnce ) . toBeTruthy ( ) ;
227229
228230 shareModel . saveLinkShare . yieldTo ( "complete" , [ shareModel ] ) ;
229231 shareModel . saveLinkShare . yieldTo ( "error" , [ shareModel , "The error message" ] ) ;
0 commit comments