File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed
testing/tests/DevExpress.ui.widgets/chatParts Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -328,14 +328,22 @@ class MessageList extends Widget<Properties> {
328328
329329 _onContextMenuShowing ( e : Cancelable & EventInfo < ContextMenu > ) : void {
330330 // @ts -expect-error ts-error
331- const { currentTarget } = e . jQEvent ;
331+ const { jQEvent } = e ;
332+
333+ if ( ! isDefined ( jQEvent ) ) {
334+ e . cancel = true ;
335+ return ;
336+ }
337+
338+ const { currentTarget } = jQEvent ;
332339
333340 const message = this . _getMessageData ( currentTarget ) ;
334341
335342 const items = this . _getContextMenuButtons ( message ) ;
336343
337344 if ( ! items . length ) {
338345 e . cancel = true ;
346+ return ;
339347 }
340348
341349 e . component . option ( 'items' , items ) ;
@@ -721,6 +729,11 @@ class MessageList extends Widget<Properties> {
721729 return this . _$content . find ( `.${ CHAT_MESSAGELIST_EMPTY_VIEW_CLASS } ` ) ;
722730 }
723731
732+ _dimensionChanged ( ) : void {
733+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
734+ this . _contextMenu ?. hide ( ) ;
735+ }
736+
724737 _clean ( ) : void {
725738 this . _lastMessageDate = null ;
726739
Original file line number Diff line number Diff line change @@ -1198,6 +1198,27 @@ QUnit.module('MessageList', () => {
11981198 assert . strictEqual ( actions [ 1 ] . icon , 'trash' , 'Delete action has the correct icon' ) ;
11991199 } ) ;
12001200
1201+ QUnit . test ( 'should be hidden after window resize' , function ( assert ) {
1202+ this . reinit ( {
1203+ allowDeleting : ( ) => true ,
1204+ allowUpdating : ( ) => true ,
1205+ items : [
1206+ { text : 'a' , author : userFirst } ,
1207+ { text : 'b' , author : userSecond } ,
1208+ ] ,
1209+ currentUserId : userSecond . id ,
1210+ } ) ;
1211+
1212+ const $bubbles = this . getBubbles ( ) ;
1213+ $bubbles . eq ( 1 ) . trigger ( 'dxcontextmenu' ) ;
1214+
1215+ assert . strictEqual ( this . contextMenu . option ( 'visible' ) , true , 'context menu is visible' ) ;
1216+
1217+ this . $element . trigger ( 'dxresize' ) ;
1218+
1219+ assert . strictEqual ( this . contextMenu . option ( 'visible' ) , false , 'context menu is hidden after window resize' ) ;
1220+ } ) ;
1221+
12011222 [
12021223 {
12031224 editingOptions : {
You can’t perform that action at this time.
0 commit comments