Skip to content

Commit 0fdc7b2

Browse files
committed
diff tests: the walk stops at the last file
1 parent 17db2e1 commit 0fdc7b2

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

‎mods/diff/tests/views.test.ts‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,38 @@ describe('views', () => {
200200
expect(walked).not.toContain('file0.ts')
201201
})
202202

203+
test('off fullscreen, the walk stops at the last file', async ($, on) => {
204+
const world = Fixtures.inRepository(on, Fixtures.MANY_FILES)
205+
206+
await $.session.start(Fixtures.SESSION)
207+
await $.command.run(Fixtures.DIALOG_DIFF)
208+
await world.clock.advance(Fixtures.SETTLE_MS)
209+
await $.ui.render(Fixtures.INLINE_PANE)
210+
await $.ui.focus(Fixtures.ringOnto('file:file3.ts'))
211+
await $.ui.render(Fixtures.INLINE_PANE)
212+
await $.ui.focus(Fixtures.ringOnto('file:file5.ts'))
213+
await $.ui.render(Fixtures.INLINE_PANE)
214+
await $.ui.focus(Fixtures.ringOnto('file:file7.ts'))
215+
await $.ui.render(Fixtures.INLINE_PANE)
216+
await $.ui.focus(Fixtures.ringOnto('file:file9.ts'))
217+
218+
const last = Fixtures.textOf(await $.ui.render(Fixtures.INLINE_PANE))
219+
220+
expect(last).toContain('\u276f file9.ts')
221+
expect(last).toContain(' \u2191 5 more files')
222+
223+
expect(
224+
await $.ui.focus(Fixtures.ringOnto('file:file5.ts')),
225+
'the ring would wrap to the first row drawn; it stays',
226+
).toEqual({})
227+
228+
expect(Fixtures.textOf(await $.ui.render(Fixtures.INLINE_PANE))).toContain(
229+
'\u276f file9.ts',
230+
)
231+
232+
expect(world.focused, 'the wrap never reached the engine').toHaveLength(4)
233+
})
234+
203235
test('off fullscreen, the dialog draws at any width', async ($, on) => {
204236
const world = Fixtures.inRepository(on, Fixtures.TWO_FILES)
205237

0 commit comments

Comments
 (0)