refactor(DropDownMenu): format

This commit is contained in:
Ivan
2026-04-22 20:11:25 -05:00
parent c66d290db7
commit 4fc80c2b53
3 changed files with 17 additions and 11 deletions
@@ -102,7 +102,12 @@ export default {
const panel = this.$refs.dropdownPanel;
if (!panel) return;
const rect = panel.getBoundingClientRect();
const { left, top, maxHeight } = clampFloatingToViewport(rect.left, rect.top, rect.width, rect.height);
const { left, top, maxHeight } = clampFloatingToViewport(
rect.left,
rect.top,
rect.width,
rect.height
);
this.dropdownPosition = { x: left, y: top, maxHeight };
});
});
@@ -1,14 +1,7 @@
<!-- SPDX-License-Identifier: 0BSD -->
<template>
<div
v-if="show"
ref="panel"
class="context-menu-panel"
:class="panelClass"
:style="panelStyle"
v-bind="$attrs"
>
<div v-if="show" ref="panel" class="context-menu-panel" :class="panelClass" :style="panelStyle" v-bind="$attrs">
<slot name="header" />
<slot />
</div>
+10 -2
View File
@@ -80,8 +80,16 @@ describe("clampFloatingToViewport wiring", () => {
it.each([
["DropDownMenu.vue", "meshchatx/src/frontend/components/DropDownMenu.vue", 'ref="dropdownPanel"'],
["LanguageSelector.vue", "meshchatx/src/frontend/components/LanguageSelector.vue", 'ref="languageDropdown"'],
["NotificationBell.vue", "meshchatx/src/frontend/components/NotificationBell.vue", 'ref="notificationDropdown"'],
["ConversationViewer.vue", "meshchatx/src/frontend/components/messages/ConversationViewer.vue", "onReactionPickerDragStart"],
[
"NotificationBell.vue",
"meshchatx/src/frontend/components/NotificationBell.vue",
'ref="notificationDropdown"',
],
[
"ConversationViewer.vue",
"meshchatx/src/frontend/components/messages/ConversationViewer.vue",
"onReactionPickerDragStart",
],
])("%s imports the helper and clamps floating UI", (_, relativePath, anchor) => {
const src = readSource(relativePath);
expect(src).toContain("clampFloatingToViewport");