Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/diff-view/src/parts/RenderCss/RenderCss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ ${getEmptyLineNumberCss(newState.visibleLinesLeft, newState.visibleLinesRight, i
background-color: rgba(128, 128, 128, 0.15);
background-image: var(--ScrollBarBackgroundImage);
border-radius: 4px;
cursor: default;
height: 100%;
position: absolute;
right: 2px;
Expand All @@ -464,7 +465,7 @@ ${getEmptyLineNumberCss(newState.visibleLinesLeft, newState.visibleLinesRight, i
.DiffScrollBarThumb {
background: rgba(128, 128, 128, 0.45);
border-radius: 4px;
cursor: pointer;
cursor: default;
height: var(--ScrollBarHeight);
position: absolute;
top: var(--ScrollBarThumbTop);
Expand Down
35 changes: 35 additions & 0 deletions packages/e2e/src/diff.scrollbar-cursor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import type { Test } from '@lvce-editor/test-with-playwright'

export const name = 'diff.scrollbar-cursor'

export const test: Test = async ({ Command, DiffView, expect, FileSystem, Locator, Workspace }) => {
const tmpDir = await FileSystem.getTmpDir()
const content = Array.from({ length: 900 }, (_, index) => `shared line ${index + 1}`).join('\n')
await FileSystem.writeFile(`${tmpDir}/before.txt`, `${content}\nbottom before`)
await FileSystem.writeFile(`${tmpDir}/after.txt`, `${content}\nbottom after`)
await Workspace.setPath(tmpDir)
await DiffView.open(`${tmpDir}/before.txt`, `${tmpDir}/after.txt`)

const scrollBar = Locator('.DiffScrollBar')
const scrollBarThumb = Locator('.DiffScrollBarThumb')
for (const mode of ['side-by-side', 'inline'] as const) {
await Command.execute('DiffView.setDiffMode', mode)
await expect(scrollBar).toHaveCSS('cursor', 'default')
await expect(scrollBarThumb).toHaveCSS('cursor', 'default')

const diffRows = Locator(mode === 'inline' ? '.InlineDiffEditor .DiffEditorRows' : '.DiffEditorContentLeft .DiffEditorRows')
await diffRows.dispatchEvent('wheel', {
bubbles: true,
deltaMode: 0,
deltaY: 9_999_999,
} as unknown as string)

await expect(diffRows).toContainText('bottom before')
if (mode === 'inline') {
await expect(diffRows).toContainText('bottom after')
} else {
const rightRows = Locator('.DiffEditorContentRight .DiffEditorRows')
await expect(rightRows).toContainText('bottom after')
}
}
}