mirror of
https://git.quad4.io/RNS-Things/MeshChatX.git
synced 2026-08-28 11:35:06 +00:00
refactor(DropDownMenu): format
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user