Skip to content
Myr

Add a test case for click-header with --header and --header-lines combined

Before adoption: this commit came in with the history the project adopted, so no landing records it.

The two sections swap order between layouts, and header-lines are reversed under layout=default, so expected LINE values differ per layout.

authored by Junegunn Choi · committed by Junegunn Choi · parent faa6a7e · Browse files · 1 file+20 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+20 added−0 removed

  • tests:+20 added−0 removed

1 file+20 added−0 removed

modified:test/test_layout.rb+20 added
1370 unmodified lines
1371 opts: %(--layout=#{layout} --style full --footer $'Foo\\nBar\\nBaz'),1372 input: 'seq 5',1373 clicks: [%w[Foo 1], %w[Bar 2], %w[Baz 3]])1374 end13751376 # --header and --header-lines combined. Click-header numbering concatenates the two1377 # sections, but the order depends on the layout:1378 # layoutReverse: custom header (1..N), then header-lines (N+1..N+M)1379 # layoutDefault: header-lines (1..M, reversed visually), then custom header (M+1..M+N)1380 # layoutReverseList: header-lines (1..M), then custom header (M+1..M+N)1381 define_method(:"test_click_header_combined_#{slug}") do1382 clicks = case layout1383 when 'reverse'1384 [%w[Aaa 1], %w[Bbb 2], %w[Ccc 3], %w[Xaa 4], %w[Ybb 5], %w[Zcc 6]]1385 when 'default'1386 [%w[Aaa 4], %w[Bbb 5], %w[Ccc 6], %w[Xaa 3], %w[Ybb 2], %w[Zcc 1]]1387 else # reverse-list1388 [%w[Aaa 4], %w[Bbb 5], %w[Ccc 6], %w[Xaa 1], %w[Ybb 2], %w[Zcc 3]]1389 end1390 verify_clicks(kind: :header,1391 opts: %(--layout=#{layout} --header $'Aaa\\nBbb\\nCcc' --header-lines 3),1392 input: "(printf 'Xaa\\nYbb\\nZcc\\n'; seq 5)",1393 clicks: clicks)1394 end1395 end1396end