mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-27 14:44:07 +00:00
fix: handle copy/paste item for requests & js file (#7656)
This commit is contained in:
@@ -565,9 +565,12 @@ const CollectionItem = ({ item, collectionUid, collectionPathname, searchText })
|
||||
};
|
||||
|
||||
const handlePasteItem = () => {
|
||||
// Paste as sibling: find the parent folder so the pasted item appears next to the focused item
|
||||
const parentFolder = findParentItemInCollection(collection, item.uid);
|
||||
const targetFolderUid = parentFolder ? parentFolder.uid : null;
|
||||
// Determine target folder: if item is a folder, paste into it; otherwise paste into parent folder
|
||||
let targetFolderUid = item.uid;
|
||||
if (!isFolder) {
|
||||
const parentFolder = findParentItemInCollection(collection, item.uid);
|
||||
targetFolderUid = parentFolder ? parentFolder.uid : null;
|
||||
}
|
||||
|
||||
dispatch(pasteItem(collectionUid, targetFolderUid))
|
||||
.then(() => {
|
||||
@@ -644,7 +647,7 @@ const CollectionItem = ({ item, collectionUid, collectionPathname, searchText })
|
||||
key={i}
|
||||
style={{ width: 16, minWidth: 16, height: '100%' }}
|
||||
>
|
||||
{/* Indent */}
|
||||
{/* Indent */}
|
||||
</div>
|
||||
))
|
||||
: null}
|
||||
|
||||
@@ -8,6 +8,7 @@ const CollectionSearch = ({ searchText, setSearchText }) => {
|
||||
<input
|
||||
type="text"
|
||||
name="search"
|
||||
data-testid="sidebar-search-input"
|
||||
placeholder="Search requests..."
|
||||
id="search"
|
||||
autoComplete="off"
|
||||
|
||||
@@ -854,7 +854,8 @@ test.describe('Shortcut Keys - BOUND_ACTIONS', () => {
|
||||
|
||||
await page.keyboard.press(`${modifier}+KeyF`);
|
||||
|
||||
await expect(page.getByPlaceholder('Search requests...')).toBeVisible({ timeout: 3000 });
|
||||
// await expect(page.getByPlaceholder('Search requests...')).toBeVisible({ timeout: 3000 });
|
||||
await expect(page.getByTestId('sidebar-search-input')).toBeVisible({ timeout: 3000 });
|
||||
await page.getByTitle('Search requests').click();
|
||||
});
|
||||
|
||||
@@ -879,7 +880,7 @@ test.describe('Shortcut Keys - BOUND_ACTIONS', () => {
|
||||
await page.keyboard.up('KeyF');
|
||||
await page.keyboard.up('Alt');
|
||||
|
||||
await expect(page.getByPlaceholder('Search requests...')).toBeVisible({ timeout: 3000 });
|
||||
await expect(page.getByTestId('sidebar-search-input')).toBeVisible({ timeout: 2000 });
|
||||
await page.getByTitle('Search requests').click();
|
||||
});
|
||||
});
|
||||
@@ -1260,8 +1261,8 @@ test.describe('Shortcut Keys - BOUND_ACTIONS', () => {
|
||||
await page.keyboard.press(`${modifier}+KeyC`);
|
||||
await page.keyboard.press(`${modifier}+KeyV`);
|
||||
|
||||
// Verify cloned request appears in sidebar
|
||||
await expect(page.locator('.collection-item-name').filter({ hasText: 'kb-folder (1)' })).toBeVisible({ timeout: 2000 });
|
||||
// Verify copied item appears in sidebar as child of folder
|
||||
await expect(page.locator('.collection-item-name').filter({ hasText: 'kb-folder' })).toHaveCount(2);
|
||||
});
|
||||
|
||||
test('customized Alt+C/V copy paste item for request', async ({ page, createTmpDir }) => {
|
||||
@@ -1338,8 +1339,8 @@ test.describe('Shortcut Keys - BOUND_ACTIONS', () => {
|
||||
await page.keyboard.up('KeyV');
|
||||
await page.keyboard.up('Alt');
|
||||
|
||||
// Verify cloned request appears in sidebar
|
||||
await expect(page.locator('.collection-item-name').filter({ hasText: 'kb-folder-copy-src (1)' })).toBeVisible({ timeout: 2000 });
|
||||
// Verify copied item appears in sidebar as child of folder
|
||||
await expect(page.locator('.collection-item-name').filter({ hasText: 'kb-folder-copy-src' })).toHaveCount(2);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user