💅 Pulse: add right border, collapse commit files by default
- Add border-r border-[var(--sidebar-border)] to PulseView container - CommitCard files default to collapsed (expanded: false) for cleaner initial state - Update tests to reflect new collapsed-by-default behavior
This commit is contained in:
@@ -104,11 +104,17 @@ describe('PulseView', () => {
|
||||
expect(nonLink.tagName).toBe('SPAN')
|
||||
})
|
||||
|
||||
it('renders file list with correct titles', async () => {
|
||||
it('renders file list with correct titles when expanded', async () => {
|
||||
mockInvokeFn.mockResolvedValue(mockCommits)
|
||||
|
||||
render(<PulseView vaultPath="/test/vault" />)
|
||||
|
||||
// Files are collapsed by default — expand all commit cards first
|
||||
await waitFor(() => {
|
||||
expect(screen.getAllByLabelText('Expand files').length).toBeGreaterThan(0)
|
||||
})
|
||||
screen.getAllByLabelText('Expand files').forEach((btn) => fireEvent.click(btn))
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('my project')).toBeInTheDocument()
|
||||
})
|
||||
@@ -122,6 +128,12 @@ describe('PulseView', () => {
|
||||
|
||||
render(<PulseView vaultPath="/test/vault" onOpenNote={onOpenNote} />)
|
||||
|
||||
// Expand first commit card
|
||||
await waitFor(() => {
|
||||
expect(screen.getAllByLabelText('Expand files').length).toBeGreaterThan(0)
|
||||
})
|
||||
fireEvent.click(screen.getAllByLabelText('Expand files')[0])
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('my project')).toBeInTheDocument()
|
||||
})
|
||||
@@ -136,6 +148,12 @@ describe('PulseView', () => {
|
||||
|
||||
render(<PulseView vaultPath="/test/vault" onOpenNote={onOpenNote} />)
|
||||
|
||||
// Expand all commit cards to find the deleted file
|
||||
await waitFor(() => {
|
||||
expect(screen.getAllByLabelText('Expand files').length).toBeGreaterThan(0)
|
||||
})
|
||||
screen.getAllByLabelText('Expand files').forEach((btn) => fireEvent.click(btn))
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('old')).toBeInTheDocument()
|
||||
})
|
||||
@@ -191,20 +209,28 @@ describe('PulseView', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('toggles file list visibility when clicking collapse button', async () => {
|
||||
it('toggles file list visibility when clicking expand/collapse button', async () => {
|
||||
mockInvokeFn.mockResolvedValue(mockCommits)
|
||||
|
||||
render(<PulseView vaultPath="/test/vault" />)
|
||||
|
||||
// Files are collapsed by default
|
||||
await waitFor(() => {
|
||||
expect(screen.getAllByLabelText('Expand files').length).toBeGreaterThan(0)
|
||||
})
|
||||
expect(screen.queryByText('my project')).not.toBeInTheDocument()
|
||||
|
||||
// Click expand on first commit card
|
||||
fireEvent.click(screen.getAllByLabelText('Expand files')[0])
|
||||
|
||||
// Files should now be visible
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('my project')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
// Click the collapse button on the first commit card
|
||||
const collapseBtn = screen.getAllByLabelText('Collapse files')[0]
|
||||
fireEvent.click(collapseBtn)
|
||||
// Click collapse to hide again
|
||||
fireEvent.click(screen.getAllByLabelText('Collapse files')[0])
|
||||
|
||||
// Files should be hidden
|
||||
expect(screen.queryByText('my project')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ function FileItem({ file, onOpenNote }: { file: PulseFile; onOpenNote?: (path: s
|
||||
}
|
||||
|
||||
function CommitCard({ commit, onOpenNote }: { commit: PulseCommit; onOpenNote?: (path: string) => void }) {
|
||||
const [expanded, setExpanded] = useState(true)
|
||||
const [expanded, setExpanded] = useState(false)
|
||||
const Chevron = expanded ? CaretDown : CaretRight
|
||||
|
||||
return (
|
||||
@@ -239,7 +239,7 @@ export const PulseView = memo(function PulseView({ vaultPath, onOpenNote, sideba
|
||||
const dayGroups = groupCommitsByDay(commits)
|
||||
|
||||
return (
|
||||
<div className="flex h-full flex-col overflow-hidden bg-background">
|
||||
<div className="flex h-full flex-col overflow-hidden border-r border-[var(--sidebar-border)] bg-background">
|
||||
{/* Header */}
|
||||
<div className="flex shrink-0 items-center justify-between border-b border-border" style={{ height: 52, padding: '0 16px' }}>
|
||||
<div className="flex items-center" style={{ gap: 8 }}>
|
||||
|
||||
Reference in New Issue
Block a user