Skip to content

Commit

Permalink
ContextMenu: empty shownMenus list on clean (T1257288)
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-shakhova committed Dec 24, 2024
1 parent 4c2eb72 commit a28060e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ class ContextMenu extends MenuBase {
this._overlay = null;
}
this._detachShowContextMenuEvents(this._getTarget());
this._shownSubmenus = [];
super._clean();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,39 @@ QUnit.module('Rendering', moduleConfig, () => {
});
});

QUnit.module('Repaint', moduleConfig, () => {
QUnit.test('On repaint all submenus should be hidden without console errors (T1257288)', function(assert) {
if(!isDeviceDesktop(assert)) {
return;
}

const instance = new ContextMenu(this.$element, {
items: this.items,
visible: true,
showSubmenuMode: { name: 'onHover', delay: 0 },
onItemClick: (e) => e.component.repaint(),
});

const $itemsContainer = instance.itemsContainer();
const $rootItem = $itemsContainer.find(`.${DX_MENU_ITEM_CLASS}`).eq(3);

$($itemsContainer).trigger($.Event('dxhoverstart', { target: $rootItem.get(0) }));
this.clock.tick(0);

let $submenus = $(`.${DX_SUBMENU_CLASS}`);
const $nestedSubmenu = $submenus.eq(1);
const $nestedSubmenuItem = $nestedSubmenu.find(`.${DX_MENU_ITEM_CLASS}`).eq(0);

assert.strictEqual($submenus.length, 2, 'Nested submenu is shown');

$($nestedSubmenuItem).trigger('click');

$submenus = $(`.${DX_SUBMENU_CLASS}`);

assert.strictEqual($submenus.length, 1, 'Nested submenu is hidden');
});
});

QUnit.module('Rendering Scrollable', moduleConfig, () => {
const DX_SCROLLABLE_CLASS = 'dx-scrollable';
const DX_SCROLLABLE_CONTAINER_CLASS = 'dx-scrollable-container';
Expand Down

0 comments on commit a28060e

Please sign in to comment.