mirror of
https://github.com/anomalyco/opencode.git
synced 2026-09-05 17:24:35 +00:00
fix(app): align add context shortcuts (#46739)
This commit is contained in:
parent
745a1c0ee6
commit
2c3f94f0ba
2 changed files with 21 additions and 1 deletions
|
|
@ -11,6 +11,23 @@ story("raises the docked composer only in dark mode", async ({ mount, page }) =>
|
|||
await expect(composer).toHaveCSS("background-color", "rgb(36, 36, 36)")
|
||||
})
|
||||
|
||||
story("centers add menu shortcuts in a consistent column", async ({ mount, page }) => {
|
||||
const component = await mount("opencode-composer-flow--empty-draft")
|
||||
await component.locator('[data-action="composer-attach"]').click()
|
||||
|
||||
const shortcuts = page.locator('[role="menu"] [data-slot="menu-v2-item-shortcut"]')
|
||||
await expect(shortcuts).toHaveCount(4)
|
||||
const boxes = await shortcuts.evaluateAll((items) =>
|
||||
items.map((item) => {
|
||||
const box = item.getBoundingClientRect()
|
||||
return { width: box.width, center: box.left + box.width / 2 }
|
||||
}),
|
||||
)
|
||||
|
||||
expect(new Set(boxes.map((box) => box.width)).size).toBe(1)
|
||||
expect(new Set(boxes.map((box) => box.center)).size).toBe(1)
|
||||
})
|
||||
|
||||
for (const draft of ["empty-draft", "multiline-draft", "mixed-attachments"]) {
|
||||
story(`select all stays inside the composer with ${draft}`, async ({ mount, page }) => {
|
||||
const component = await mount(`opencode-composer-flow--${draft}`)
|
||||
|
|
|
|||
|
|
@ -555,7 +555,10 @@ export function ComposerEditorAddMenu(props: {
|
|||
aria-label={props.title}
|
||||
/>
|
||||
<Menu.Portal>
|
||||
<Menu.Content style={{ "min-width": "180px" }}>
|
||||
<Menu.Content
|
||||
class="[&_[data-slot=menu-v2-item-shortcut]]:w-8 [&_[data-slot=menu-v2-item-shortcut]]:justify-center"
|
||||
style={{ "min-width": "180px" }}
|
||||
>
|
||||
<Menu.Item onSelect={props.onAttach} shortcut={props.attachShortcut}>
|
||||
{props.attachLabel}
|
||||
</Menu.Item>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue