copy paste
Some checks failed
CI / check (push) Has been cancelled

This commit is contained in:
2026-06-17 13:40:49 +02:00
parent 16296a27da
commit 42defcc7cd
11 changed files with 104 additions and 22 deletions

View File

@@ -23,6 +23,18 @@ function renderApp(): HTMLElement {
function find(c: HTMLElement, sel: string, text: string): HTMLElement | undefined {
return Array.from(c.querySelectorAll<HTMLElement>(sel)).find((el) => el.textContent?.includes(text))
}
// The tree opens fully collapsed, so expand each ancestor folder before reaching
// a nested file. Each folder is clicked exactly once (a second click collapses).
async function expandTo(c: HTMLElement, ...folders: string[]): Promise<void> {
for (const name of folders) {
const row = await waitFor(() => {
const r = find(c, '.tree-row', name)
if (!r) throw new Error(`folder ${name} not ready`)
return r
})
fireEvent.click(row)
}
}
describe('Pass on to Agent', () => {
it('inserts "<note> <path:line>" via the agentPaste event', async () => {
@@ -31,6 +43,7 @@ describe('Pass on to Agent', () => {
window.addEventListener('agentPaste', handler)
try {
const c = renderApp()
await expandTo(c, 'public', 'assets')
const treeRow = await waitFor(() => {
const r = find(c, '.tree-row', 'store.js')
if (!r) throw new Error('tree not ready')

View File

@@ -33,6 +33,18 @@ function renderApp(): HTMLElement {
function rowWithText(container: HTMLElement, selector: string, text: string): HTMLElement | undefined {
return Array.from(container.querySelectorAll<HTMLElement>(selector)).find((el) => el.textContent?.includes(text))
}
// The tree opens fully collapsed, so expand each ancestor folder before reaching
// a nested file. Each folder is clicked exactly once (a second click collapses).
async function expandTo(c: HTMLElement, ...folders: string[]): Promise<void> {
for (const name of folders) {
const row = await waitFor(() => {
const r = rowWithText(c, '.tree-row', name)
if (!r) throw new Error(`folder ${name} not ready`)
return r
})
fireEvent.click(row)
}
}
describe('App (mock data, jsdom)', () => {
it('renders the four-column workbench with the git change list', async () => {
@@ -62,6 +74,7 @@ describe('App (mock data, jsdom)', () => {
it('makes an edited buffer dirty (breadcrumb dot)', async () => {
const c = renderApp()
await expandTo(c, 'public', 'assets')
const treeRow = await waitFor(() => {
const r = rowWithText(c, '.tree-row', 'store.js')
if (!r) throw new Error('tree not ready')

View File

@@ -47,7 +47,7 @@ describe('readAll', () => {
expect(files['src/a.ts']).toContain('export const a')
})
it('honors .gitignore in a repo (files.followGitignore default on)', async () => {
it('shows .gitignored files in a repo (files.followGitignore default off)', async () => {
dir = await mkdtemp(join(tmpdir(), 'helder-fs-'))
await simpleGit(dir).init()
await writeFile(join(dir, '.gitignore'), 'secret.txt\n')
@@ -55,7 +55,7 @@ describe('readAll', () => {
await writeFile(join(dir, 'keep.txt'), 'ok')
const keys = Object.keys(await readAll(dir))
expect(keys).toContain('keep.txt')
expect(keys).not.toContain('secret.txt')
expect(keys).toContain('secret.txt') // gitignore not followed by default → shown
})
})