Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContextMenu: empty shownMenus list on clean (T1257288) #28628

Merged
merged 1 commit into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,41 @@ 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: [{ text: 'Item 1', items: [{ text: 'Item 11' }, { text: 'Item 12' }] }],
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(0);

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

const $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');

try {
$($nestedSubmenuItem).trigger('dxclick');

assert.ok(true, 'No errors were thrown');
} catch(e) {
assert.ok(false, `Error: ${e.message}`);
}
});
});

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