fix(web): label only the first prompt row with the working directory
A multi-line command repeated the cwd label on every prompt row, which states something the view does not know: it carries ONE working directory — where the call started — and a `cd` in the command moves later lines elsewhere. `cd ~` then `ls` rendered both rows labelled with the session workspace while `ls` actually listed the home directory. The label now appears on the first row only, and later rows keep a bare `$` so they still read as prompts. Same reasoning as the run-state dot: neither a per-line directory nor a per-line exit status exists to report. The built-bundle snapshot records the effect on fixture turn 60's two-line command (`fixture echo done` becomes `$ echo done`).
This commit is contained in:
@@ -212,6 +212,14 @@ describe('TerminalBlock run-state dot', () => {
|
||||
expect([...row!.children].map(node => node.textContent)).toEqual(['', 'app', 'ls'])
|
||||
})
|
||||
|
||||
// The cwd labels the call, not each line: a `cd` in the command moves later
|
||||
// lines elsewhere, so repeating the label would state a directory per line
|
||||
// that the view does not know.
|
||||
it('labels only the first row with the cwd, leaving later rows a bare $', () => {
|
||||
const view = render(<TerminalBlock command={'cd ~\nls'} cwd="/srv/app" output="a" exitCode={0} />)
|
||||
expect(promptRows(view.container)).toEqual(['appcd ~', '$ls'])
|
||||
})
|
||||
|
||||
it('gives a multi-line command one row per line', () => {
|
||||
const view = render(<TerminalBlock command={'echo one\necho two'} output="a" exitCode={0} />)
|
||||
expect(promptRows(view.container)).toEqual(['$echo one', '$echo two'])
|
||||
|
||||
Reference in New Issue
Block a user