Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

1.8 KB
Raw Blame
import { describe, expect, it } from 'vitest'
import {
  canDockPrSidebar,
  resolvePresentationMode,
  shouldShowTrigger
} from './mobile-pr-sidebar-presentation'

describe('resolvePresentationMode', () => {
  it('docks inline on wide layouts and overlays on narrow', () => {
    expect(resolvePresentationMode(true)).toBe('inline')
    expect(resolvePresentationMode(false)).toBe('overlay')
  })

  it('overlays on wide layouts when the measured pane cannot fit both columns', () => {
    expect(resolvePresentationMode(true, false)).toBe('overlay')
  })
})

describe('canDockPrSidebar', () => {
  it('requires both wide layout and enough measured width', () => {
    expect(canDockPrSidebar({ isWideLayout: true, availableWidth: 700, dockWidth: 340 })).toBe(true)
    expect(canDockPrSidebar({ isWideLayout: true, availableWidth: 699, dockWidth: 340 })).toBe(
      false
    )
    expect(canDockPrSidebar({ isWideLayout: false, availableWidth: 900, dockWidth: 340 })).toBe(
      false
    )
  })
})

describe('shouldShowTrigger', () => {
  it('shows the trigger on a GitHub repo in narrow/overlay mode', () => {
    expect(shouldShowTrigger({ isGithubRepo: true, isWideLayout: false })).toBe(true)
  })

  it('hides the trigger in wide/docked mode even on a GitHub repo', () => {
    expect(shouldShowTrigger({ isGithubRepo: true, isWideLayout: true })).toBe(false)
  })

  it('shows the trigger on a wide GitHub repo when the sidebar cannot dock', () => {
    expect(shouldShowTrigger({ isGithubRepo: true, isWideLayout: true, canDock: false })).toBe(true)
  })

  it('hides the trigger on a non-GitHub repo regardless of layout', () => {
    expect(shouldShowTrigger({ isGithubRepo: false, isWideLayout: false })).toBe(false)
    expect(shouldShowTrigger({ isGithubRepo: false, isWideLayout: true })).toBe(false)
  })
})