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
4 changes: 3 additions & 1 deletion packages/diff-view/src/parts/RenderCss/RenderCss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const renderCss = (oldState: DiffViewState, newState: DiffViewState): any
--DiffEditorHeight: ${height}px;
--EditorRowHeight: ${itemHeight}px;
--ScrollBarHeight: ${scrollBarHeight}px;
--ScrollBarBackgroundImage: ${scrollBarBackgroundImage};
--ScrollBarThumbTop: ${scrollBarThumbTop}px;
}

Expand Down Expand Up @@ -96,6 +97,7 @@ export const renderCss = (oldState: DiffViewState, newState: DiffViewState): any

.DiffEditorRows {
contain: strict;
cursor: text;
flex: 1;
font-family: monospace;
min-width: 0;
Expand Down Expand Up @@ -186,7 +188,7 @@ export const renderCss = (oldState: DiffViewState, newState: DiffViewState): any

.DiffScrollBar {
background-color: rgba(128, 128, 128, 0.15);
background-image: ${scrollBarBackgroundImage};
background-image: var(--ScrollBarBackgroundImage);
border-radius: 4px;
height: 100%;
position: absolute;
Expand Down
3 changes: 2 additions & 1 deletion packages/diff-view/test/RenderCss.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { createDefaultState } from '../src/parts/CreateDefaultState/CreateDefaultState.ts'
import { renderCss } from '../src/parts/RenderCss/RenderCss.ts'

test.skip('renderCss renders left and right widths as css variables', (): void => {

Check warning on line 6 in packages/diff-view/test/RenderCss.test.ts

View workflow job for this annotation

GitHub Actions / pr (macos-15)

Tests should not be skipped

Check warning on line 6 in packages/diff-view/test/RenderCss.test.ts

View workflow job for this annotation

GitHub Actions / pr (ubuntu-24.04)

Tests should not be skipped

Check warning on line 6 in packages/diff-view/test/RenderCss.test.ts

View workflow job for this annotation

GitHub Actions / pr (windows-2025)

Tests should not be skipped
const oldState = createDefaultState()
const newState = {
...oldState,
Expand Down Expand Up @@ -50,12 +50,13 @@
expect(result[2]).toContain('overflow: auto;')
expect(result[2]).toContain('.DiffEditorSpacerTop {')
expect(result[2]).toContain('.DiffScrollBarThumb {')
expect(result[2]).toContain('background-image: linear-gradient(to bottom, transparent 0%,')
expect(result[2]).toContain('--ScrollBarBackgroundImage: linear-gradient(to bottom, transparent 0%,')
expect(result[2]).toContain('background-image: var(--ScrollBarBackgroundImage);')
expect(result[2]).toContain('rgba(248, 81, 73, 0.72) 0%')
expect(result[2]).toContain('rgba(46, 160, 67, 0.72)')
})

test.skip('renderCss renders stacked pane heights for vertical layout', (): void => {

Check warning on line 59 in packages/diff-view/test/RenderCss.test.ts

View workflow job for this annotation

GitHub Actions / pr (macos-15)

Tests should not be skipped

Check warning on line 59 in packages/diff-view/test/RenderCss.test.ts

View workflow job for this annotation

GitHub Actions / pr (ubuntu-24.04)

Tests should not be skipped

Check warning on line 59 in packages/diff-view/test/RenderCss.test.ts

View workflow job for this annotation

GitHub Actions / pr (windows-2025)

Tests should not be skipped
const oldState = createDefaultState()
const newState = {
...oldState,
Expand Down Expand Up @@ -84,7 +85,7 @@
expect(result[2]).toContain('.SashHorizontal {')
})

test.skip('renderCss includes inline diff styling hooks', (): void => {

Check warning on line 88 in packages/diff-view/test/RenderCss.test.ts

View workflow job for this annotation

GitHub Actions / pr (macos-15)

Tests should not be skipped

Check warning on line 88 in packages/diff-view/test/RenderCss.test.ts

View workflow job for this annotation

GitHub Actions / pr (ubuntu-24.04)

Tests should not be skipped

Check warning on line 88 in packages/diff-view/test/RenderCss.test.ts

View workflow job for this annotation

GitHub Actions / pr (windows-2025)

Tests should not be skipped
const oldState = createDefaultState()
const newState = {
...oldState,
Expand Down
19 changes: 19 additions & 0 deletions packages/diff-view/test/RenderCssCursor.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { expect, test } from '@jest/globals'
import { createDefaultState } from '../src/parts/CreateDefaultState/CreateDefaultState.ts'
import { renderCss } from '../src/parts/RenderCss/RenderCss.ts'

test('renderCss applies a text cursor only to the diff rows surface', (): void => {
const oldState = createDefaultState()
const newState = {
...oldState,
id: 1,
}

const result = renderCss(oldState, newState)

expect(result[2]).toContain('.DiffEditorRows {')
expect(result[2]).toContain('cursor: text;')
expect(result[2]).toContain('.DiffEditorGutter {')
expect(result[2]).toContain('.SashVertical {')
expect(result[2]).toContain('cursor: col-resize;')
})
Loading