fix(client): preserve sidebar drag ordering
This commit is contained in:
@@ -77,11 +77,14 @@ describe('WorkspaceBrowser.module.css list', () => {
|
||||
})
|
||||
|
||||
it('draws drag targets as a hollow leading dot joined to the insertion line', () => {
|
||||
const listTopMarker = declarations('.listTopDropIndicator')
|
||||
const workspaceMarker = declarations('.workspaceDropBefore::before')
|
||||
const sessionMarker = rowDeclarations('.sessionRow.dropBefore::before')
|
||||
expect(listTopMarker?.get('top')).toBe('-8px')
|
||||
expect(listTopMarker?.get('left')).toBe('-4px')
|
||||
expect(workspaceMarker?.get('left')).toBe('-4px')
|
||||
expect(sessionMarker?.get('left')).toBe('0')
|
||||
for (const marker of [workspaceMarker, sessionMarker]) {
|
||||
for (const marker of [listTopMarker, workspaceMarker, sessionMarker]) {
|
||||
expect(marker?.get('height')).toBe('12px')
|
||||
expect(marker?.get('background')).toContain('radial-gradient')
|
||||
expect(marker?.get('background')).toContain('linear-gradient')
|
||||
|
||||
@@ -661,6 +661,28 @@ describe('WorkspaceBrowser', () => {
|
||||
expect(insertWorkspaceBefore).toHaveBeenCalledWith(wid('tail'), wid('beta'))
|
||||
})
|
||||
|
||||
it('draws the first Workspace insertion boundary on the scroll container', () => {
|
||||
mount({
|
||||
useWorkspaces: hook(workspaceState([
|
||||
workspace('alpha', []),
|
||||
workspace('beta', []),
|
||||
])),
|
||||
})
|
||||
const source = screen.getByText('beta').closest('[role="treeitem"]') as HTMLElement
|
||||
let firstSection = screen.getByText('alpha').closest('[role="treeitem"]')?.parentElement as HTMLElement
|
||||
while (firstSection.parentElement?.getAttribute('role') !== 'tree') {
|
||||
firstSection = firstSection.parentElement as HTMLElement
|
||||
}
|
||||
firstSection.getBoundingClientRect = () => ({
|
||||
top: 100, bottom: 134, left: 0, right: 200, width: 200, height: 34, x: 0, y: 100, toJSON: () => ({}),
|
||||
})
|
||||
fireEvent.dragStart(source, { dataTransfer: dragData() })
|
||||
fireDrag(firstSection, 'dragOver', 105)
|
||||
expect(firstSection.parentElement?.className).toContain('listTopDropActive')
|
||||
const marker = firstSection.parentElement?.previousElementSibling
|
||||
expect(marker?.className).toContain('listTopDropIndicator')
|
||||
})
|
||||
|
||||
it('accepts a document-level drop and commits the last Workspace marker on drag end', () => {
|
||||
const insertWorkspaceBefore = vi.fn(async () => {})
|
||||
mount({
|
||||
|
||||
Reference in New Issue
Block a user