test(ui-conversation): pin all three list-summary shapes for the settling exemption
The mount fixture always listed the session, so the case named "no list summary" actually exercised a row proving non-blank. An omitSummaryRow option drops the row, and the three cases now pin blank:false, an absent row, and the summary-proven blank open.
This commit is contained in:
@@ -85,15 +85,20 @@ function mount(
|
|||||||
overlayTakeover?: boolean
|
overlayTakeover?: boolean
|
||||||
/** The session list summary's `blank` flag — independent of the snapshot's. */
|
/** The session list summary's `blank` flag — independent of the snapshot's. */
|
||||||
summaryBlank?: boolean
|
summaryBlank?: boolean
|
||||||
|
/** Drop the session's summary row entirely (a session the list has not caught up with). */
|
||||||
|
omitSummaryRow?: boolean
|
||||||
} = {},
|
} = {},
|
||||||
) {
|
) {
|
||||||
const root = sid('root')
|
const root = sid('root')
|
||||||
|
const rootRow = { id: root, displayTitle: 'Root', running: false, waitingApproval: false, blank: false, updatedAt: 1 }
|
||||||
|
const childRow = {
|
||||||
|
id: SID, displayTitle: 'Child', parentId: root, cwd: '/projects/one',
|
||||||
|
running: false, waitingApproval: false, blank: options.summaryBlank ?? false, updatedAt: 2,
|
||||||
|
}
|
||||||
|
const listed = options.omitSummaryRow !== true
|
||||||
const sessions = createSnapshotStore<SessionListState>({
|
const sessions = createSnapshotStore<SessionListState>({
|
||||||
ids: [root, SID],
|
ids: listed ? [root, SID] : [root],
|
||||||
byId: {
|
byId: { [root]: rootRow, ...listed && { [SID]: childRow } },
|
||||||
[root]: { id: root, displayTitle: 'Root', running: false, waitingApproval: false, blank: false, updatedAt: 1 },
|
|
||||||
[SID]: { id: SID, displayTitle: 'Child', parentId: root, cwd: '/projects/one', running: false, waitingApproval: false, blank: options.summaryBlank ?? false, updatedAt: 2 },
|
|
||||||
},
|
|
||||||
current: SID,
|
current: SID,
|
||||||
phase: 'ready',
|
phase: 'ready',
|
||||||
})
|
})
|
||||||
@@ -274,13 +279,24 @@ describe('ConversationRoot resident composer', () => {
|
|||||||
expect(b.view.getByText('Selected Folder')).toBeTruthy()
|
expect(b.view.getByText('Selected Folder')).toBeTruthy()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('settling phase: a blank session with no list summary hides the composer while it opens', () => {
|
it('settling phase: a summary that does not prove the session blank hides the composer while it opens', () => {
|
||||||
const b = mount(conversationSnapshot({ composerPhase: 'blank', blank: true, openState: 'loading' }))
|
const b = mount(conversationSnapshot({ composerPhase: 'blank', blank: true, openState: 'loading' }))
|
||||||
const root = b.view.container.querySelector('[data-phase]')
|
const root = b.view.container.querySelector('[data-phase]')
|
||||||
expect(root?.getAttribute('data-phase')).toBe('settling')
|
expect(root?.getAttribute('data-phase')).toBe('settling')
|
||||||
expect(b.view.queryByText('开始构建吧')).toBeNull()
|
expect(b.view.queryByText('开始构建吧')).toBeNull()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('settling phase: a session the list has no row for settles conservatively', () => {
|
||||||
|
const b = mount(
|
||||||
|
conversationSnapshot({ composerPhase: 'blank', blank: true, openState: 'loading' }),
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
{ omitSummaryRow: true },
|
||||||
|
)
|
||||||
|
const root = b.view.container.querySelector('[data-phase]')
|
||||||
|
expect(root?.getAttribute('data-phase')).toBe('settling')
|
||||||
|
})
|
||||||
|
|
||||||
it('startup auto-selection: a summary-proven blank session opens straight into the hero', () => {
|
it('startup auto-selection: a summary-proven blank session opens straight into the hero', () => {
|
||||||
const b = mount(
|
const b = mount(
|
||||||
conversationSnapshot({ composerPhase: 'blank', blank: true, openState: 'loading' }),
|
conversationSnapshot({ composerPhase: 'blank', blank: true, openState: 'loading' }),
|
||||||
|
|||||||
Reference in New Issue
Block a user