@@ -154,19 +154,23 @@ describe('MessageActionsBoxComponent', () => {
154154 expect ( queryFlagAction ( ) ) . toBeNull ( ) ;
155155 expect ( queryQuoteAction ( ) ) . toBeNull ( ) ;
156156
157- component . enabledActions = [ 'pin' , 'edit-any' , 'delete-any' ] ;
157+ component . enabledActions = [
158+ 'pin-message' ,
159+ 'update-any-message' ,
160+ 'delete-any' ,
161+ ] ;
158162 component . ngOnChanges ( { enabledActions : { } as SimpleChange } ) ;
159163 fixture . detectChanges ( ) ;
160164
161165 expect ( queryDeleteAction ( ) ) . not . toBeNull ( ) ;
162166 expect ( queryEditAction ( ) ) . not . toBeNull ( ) ;
163- expect ( queryPinAction ( ) ) . not . toBeNull ( ) ;
167+ expect ( queryPinAction ( ) ) . toBeNull ( ) ;
164168 expect ( queryMuteAction ( ) ) . toBeNull ( ) ;
165169 expect ( queryFlagAction ( ) ) . toBeNull ( ) ;
166170 expect ( queryQuoteAction ( ) ) . toBeNull ( ) ;
167171 } ) ;
168172
169- it ( `should only display 'flag' action for other user's messages` , ( ) => {
173+ it ( `should only display 'flag-message ' action for other user's messages` , ( ) => {
170174 component . enabledActions = [ 'flag-message' ] ;
171175 component . isMine = false ;
172176 component . ngOnChanges ( {
@@ -187,7 +191,7 @@ describe('MessageActionsBoxComponent', () => {
187191 } ) ;
188192
189193 it ( 'should handle quote action' , ( ) => {
190- component . enabledActions = [ 'quote' ] ;
194+ component . enabledActions = [ 'quote-message ' ] ;
191195 component . ngOnChanges ( { enabledActions : { } as SimpleChange } ) ;
192196 fixture . detectChanges ( ) ;
193197 const spy = TestBed . inject ( ChannelService ) . selectMessageToQuote ;
@@ -211,7 +215,7 @@ describe('MessageActionsBoxComponent', () => {
211215 ...component . message ! ,
212216 quoted_message : mockMessage ( ) as any as MessageResponseBase ,
213217 } ;
214- component . enabledActions = [ 'quote' ] ;
218+ component . enabledActions = [ 'quote-message ' ] ;
215219 component . ngOnChanges ( {
216220 message : { } as SimpleChange ,
217221 enabledActions : { } as SimpleChange ,
@@ -221,9 +225,10 @@ describe('MessageActionsBoxComponent', () => {
221225 expect ( queryQuoteAction ( ) ) . toBeNull ( ) ;
222226 } ) ;
223227
224- it ( 'should display the pin action label correctly' , ( ) => {
228+ // eslint-disable-next-line jasmine/no-disabled-tests
229+ xit ( 'should display the pin action label correctly' , ( ) => {
225230 component . message = { ...message , ...{ pinned : false } } ;
226- component . enabledActions = [ 'pin' ] ;
231+ component . enabledActions = [ 'pin-message ' ] ;
227232 component . ngOnChanges ( {
228233 message : { } as SimpleChange ,
229234 enabledActions : { } as SimpleChange ,
@@ -240,8 +245,9 @@ describe('MessageActionsBoxComponent', () => {
240245 expect ( pinAction ?. textContent ) . toContain ( 'Unpin' ) ;
241246 } ) ;
242247
243- it ( 'should handle pin action' , ( ) => {
244- component . enabledActions = [ 'pin' ] ;
248+ // eslint-disable-next-line jasmine/no-disabled-tests
249+ xit ( 'should handle pin action' , ( ) => {
250+ component . enabledActions = [ 'pin-message' ] ;
245251 component . ngOnChanges ( { enabledActions : { } as SimpleChange } ) ;
246252 fixture . detectChanges ( ) ;
247253 spyOn ( window , 'alert' ) . and . callThrough ( ) ;
@@ -252,24 +258,10 @@ describe('MessageActionsBoxComponent', () => {
252258 expect ( window . alert ) . toHaveBeenCalledWith ( jasmine . anything ( ) ) ;
253259 } ) ;
254260
255- it ( 'should handle mute action' , ( ) => {
256- component . enabledActions = [ 'mute' ] ;
257- component . ngOnChanges ( {
258- enabledActions : { } as SimpleChange ,
259- } ) ;
260- fixture . detectChanges ( ) ;
261- spyOn ( window , 'alert' ) . and . callThrough ( ) ;
262- const action = queryMuteAction ( ) ;
263- action ?. click ( ) ;
264- fixture . detectChanges ( ) ;
265-
266- expect ( window . alert ) . toHaveBeenCalledWith ( jasmine . anything ( ) ) ;
267- } ) ;
268-
269261 it ( 'should handle flag action' , async ( ) => {
270262 const notificationService = TestBed . inject ( NotificationService ) ;
271263 spyOn ( notificationService , 'addTemporaryNotification' ) ;
272- component . enabledActions = [ 'flag' ] ;
264+ component . enabledActions = [ 'flag-message ' ] ;
273265 component . ngOnChanges ( { enabledActions : { } as SimpleChange } ) ;
274266 fixture . detectChanges ( ) ;
275267 const action = queryFlagAction ( ) ;
@@ -288,7 +280,7 @@ describe('MessageActionsBoxComponent', () => {
288280 const notificationService = TestBed . inject ( NotificationService ) ;
289281 spyOn ( notificationService , 'addTemporaryNotification' ) ;
290282 mockChatClient . flagMessage . and . rejectWith ( ) ;
291- component . enabledActions = [ 'flag' ] ;
283+ component . enabledActions = [ 'flag-message ' ] ;
292284 component . ngOnChanges ( { enabledActions : { } as SimpleChange } ) ;
293285 fixture . detectChanges ( ) ;
294286 const action = queryFlagAction ( ) ;
@@ -304,10 +296,10 @@ describe('MessageActionsBoxComponent', () => {
304296
305297 it ( 'should emit the number of displayed actions' , ( ) => {
306298 component . enabledActions = [
307- 'pin' ,
299+ 'pin-message ' ,
308300 'update-own-message' ,
309301 'delete-own-message' ,
310- 'flag' ,
302+ 'flag-message ' ,
311303 ] ;
312304 component . isMine = true ;
313305 const spy = jasmine . createSpy ( ) ;
@@ -318,16 +310,15 @@ describe('MessageActionsBoxComponent', () => {
318310 } ) ;
319311 fixture . detectChanges ( ) ;
320312
321- expect ( spy ) . toHaveBeenCalledWith ( 3 ) ;
313+ expect ( spy ) . toHaveBeenCalledWith ( 2 ) ;
322314
323315 spy . calls . reset ( ) ;
324316 component . enabledActions = [
325- 'pin' ,
317+ 'pin-message ' ,
326318 'update-any-message' ,
327319 'delete' ,
328- 'flag' ,
329- 'quote' ,
330- 'mute' ,
320+ 'flag-message' ,
321+ 'quote-message' ,
331322 ] ;
332323 component . isMine = false ;
333324 component . ngOnChanges ( {
@@ -336,12 +327,12 @@ describe('MessageActionsBoxComponent', () => {
336327 } ) ;
337328 fixture . detectChanges ( ) ;
338329
339- expect ( spy ) . toHaveBeenCalledWith ( 5 ) ;
330+ expect ( spy ) . toHaveBeenCalledWith ( 3 ) ;
340331 } ) ;
341332
342333 describe ( 'should display edit action' , ( ) => {
343334 it ( 'if #enabledActions contains "edit" and #isMine' , ( ) => {
344- component . enabledActions = [ 'edit ' ] ;
335+ component . enabledActions = [ 'update-own-message ' ] ;
345336 component . isMine = false ;
346337 component . ngOnChanges ( {
347338 enabledActions : { } as SimpleChange ,
@@ -359,7 +350,7 @@ describe('MessageActionsBoxComponent', () => {
359350 } ) ;
360351
361352 it ( 'if #enabledActions contains "edit-any"' , ( ) => {
362- component . enabledActions = [ 'edit -any' ] ;
353+ component . enabledActions = [ 'update -any-message ' ] ;
363354 component . isMine = false ;
364355 component . ngOnChanges ( {
365356 enabledActions : { } as SimpleChange ,
@@ -408,7 +399,12 @@ describe('MessageActionsBoxComponent', () => {
408399 it ( 'should emit #isEditing if user starts to edit' , ( ) => {
409400 const spy = jasmine . createSpy ( ) ;
410401 component . isEditing . subscribe ( spy ) ;
411- component . enabledActions = [ 'pin' , 'edit-any' , 'delete' , 'flag' ] ;
402+ component . enabledActions = [
403+ 'pin-message' ,
404+ 'update-any-message' ,
405+ 'delete' ,
406+ 'flag-message' ,
407+ ] ;
412408 component . ngOnChanges ( {
413409 enabledActions : { } as SimpleChange ,
414410 } ) ;
@@ -420,7 +416,7 @@ describe('MessageActionsBoxComponent', () => {
420416 } ) ;
421417
422418 it ( 'should open modal if user starts to edit' , ( ) => {
423- component . enabledActions = [ 'edit ' ] ;
419+ component . enabledActions = [ 'update-own-message ' ] ;
424420 component . isMine = true ;
425421 component . ngOnChanges ( {
426422 enabledActions : { } as SimpleChange ,
@@ -434,7 +430,7 @@ describe('MessageActionsBoxComponent', () => {
434430 } ) ;
435431
436432 it ( 'should display message input if user starts to edit' , ( ) => {
437- component . enabledActions = [ 'edit -any' ] ;
433+ component . enabledActions = [ 'update -any-message ' ] ;
438434 component . ngOnChanges ( {
439435 enabledActions : { } as SimpleChange ,
440436 } ) ;
@@ -446,7 +442,7 @@ describe('MessageActionsBoxComponent', () => {
446442 } ) ;
447443
448444 it ( 'should call update message if "Send" button is clicked' , ( ) => {
449- component . enabledActions = [ 'edit -any' ] ;
445+ component . enabledActions = [ 'update -any-message ' ] ;
450446 component . isEditModalOpen = true ;
451447 component . ngOnChanges ( {
452448 enabledActions : { } as SimpleChange ,
@@ -463,7 +459,7 @@ describe('MessageActionsBoxComponent', () => {
463459 } ) ;
464460
465461 it ( 'should close modal with "Cancel" button' , ( ) => {
466- component . enabledActions = [ 'edit ' ] ;
462+ component . enabledActions = [ 'update-own-message ' ] ;
467463 component . isMine = true ;
468464 component . ngOnChanges ( {
469465 enabledActions : { } as SimpleChange ,
@@ -482,7 +478,7 @@ describe('MessageActionsBoxComponent', () => {
482478 } ) ;
483479
484480 it ( 'should update #isEditModalOpen if modal is closed' , ( ) => {
485- component . enabledActions = [ 'edit ' ] ;
481+ component . enabledActions = [ 'update-own-message ' ] ;
486482 component . isMine = true ;
487483 component . isEditModalOpen = true ;
488484 component . ngOnChanges ( {
@@ -502,7 +498,7 @@ describe('MessageActionsBoxComponent', () => {
502498 } ) ;
503499
504500 it ( 'should close modal if message was updated successfully' , ( ) => {
505- component . enabledActions = [ 'edit ' ] ;
501+ component . enabledActions = [ 'update-own-message ' ] ;
506502 component . isMine = true ;
507503 component . ngOnChanges ( {
508504 enabledActions : { } as SimpleChange ,
0 commit comments