From a5beb08ed72215e8b015851ad70bf3beca526429 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 5 Jan 2025 23:02:52 +0900 Subject: Border around the header section Close #4159 --- test/test_go.rb | 207 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 193 insertions(+), 14 deletions(-) (limited to 'test') diff --git a/test/test_go.rb b/test/test_go.rb index 4aff448a..e46e1600 100755 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -3485,6 +3485,24 @@ class TestGoFZF < TestBase tmux.until { assert_block(block, _1) } end + def test_input_border_and_label_header_first + tmux.send_keys %(seq 100 | #{FZF} --border rounded --input-border bold --input-label input --input-label-pos 2 --header-lines 3 --query 1 --padding 1,2 --header-first), :Enter + block = <<~BLOCK + │ 11 + │ > 10 + │ ┏input━━━━━ + │ ┃ 19/97 + │ ┃ > 1 + │ ┗━━━━━━━━━━ + │ 3 + │ 2 + │ 1 + │ + ╰────────────── + BLOCK + tmux.until { assert_block(block, _1) } + end + def test_list_input_border_and_label tmux.send_keys %( seq 100 | #{FZF} --border rounded --list-border double --input-border bold --list-label-pos 2:bottom --input-label-pos 2 --header-lines 3 --query 1 --padding 1,2 \ @@ -3494,32 +3512,193 @@ class TestGoFZF < TestBase block = <<~BLOCK │ ║ 11 │ ║ > 10 - │ ║ 3 - │ ║ 2 - │ ║ 1 - │ ╚LIST═════ - │ ┏INPUT━━━━ + │ ╚LIST══════ + │ 3 + │ 2 + │ 1 + │ ┏INPUT━━━━━ │ ┃ 19/97 │ ┃ > 1 - │ ┗━━━━━━━━━ + │ ┗━━━━━━━━━━ │ - ╰───────────── + ╰────────────── BLOCK tmux.until { assert_block(block, _1) } tmux.send_keys :Space block = <<~BLOCK │ ║ 11 │ ║ > 10 - │ ║ 3 - │ ║ 2 - │ ║ 1 - │ ╚ list ═══ - │ ┏ input ━━ + │ ╚ list ════ + │ 3 + │ 2 + │ 1 + │ ┏ input ━━━ │ ┃ 19/97 │ ┃ > 1 - │ ┗━━━━━━━━━ + │ ┗━━━━━━━━━━ │ - ╰───────────── + ╰────────────── + BLOCK + tmux.until { assert_block(block, _1) } + end + + def test_list_input_border_and_label_header_first + tmux.send_keys %( + seq 100 | #{FZF} --border rounded --list-border double --input-border bold --list-label-pos 2:bottom --input-label-pos 2 --header-lines 3 --query 1 --padding 1,2 \ + --bind 'start:transform-input-label(echo INPUT)+transform-list-label(echo LIST)' \ + --bind 'space:change-input-label( input )+change-list-label( list )' --header-first + ).strip, :Enter + block = <<~BLOCK + │ ║ 11 + │ ║ > 10 + │ ╚LIST══════ + │ ┏INPUT━━━━━ + │ ┃ 19/97 + │ ┃ > 1 + │ ┗━━━━━━━━━━ + │ 3 + │ 2 + │ 1 + │ + ╰────────────── + BLOCK + tmux.until { assert_block(block, _1) } + tmux.send_keys :Space + block = <<~BLOCK + │ ║ 11 + │ ║ > 10 + │ ╚ list ════ + │ ┏ input ━━━ + │ ┃ 19/97 + │ ┃ > 1 + │ ┗━━━━━━━━━━ + │ 3 + │ 2 + │ 1 + │ + ╰────────────── + BLOCK + tmux.until { assert_block(block, _1) } + end + + def test_header_border_and_label + tmux.send_keys %(seq 100 | #{FZF} --border rounded --header-lines 3 --header-border sharp --header-label header --header-label-pos 2:bottom --query 1 --padding 1,2), :Enter + block = <<~BLOCK + │ 12 + │ 11 + │ > 10 + │ ┌──────── + │ │ 3 + │ │ 2 + │ │ 1 + │ └header── + │ 19/97 ─ + │ > 1 + │ + ╰──────────── + BLOCK + tmux.until { assert_block(block, _1) } + end + + def test_header_border_and_label_header_first + tmux.send_keys %(seq 100 | #{FZF} --border rounded --header-lines 3 --header-border sharp --header-label header --header-label-pos 2:bottom --query 1 --padding 1,2 --header-first), :Enter + block = <<~BLOCK + │ 12 + │ 11 + │ > 10 + │ 19/97 ─ + │ > 1 + │ ┌──────── + │ │ 3 + │ │ 2 + │ │ 1 + │ └header── + │ + ╰──────────── + BLOCK + tmux.until { assert_block(block, _1) } + end + + def test_header_border_and_label_with_list_border + tmux.send_keys %(seq 100 | #{FZF} --border rounded --list-border double --list-label list --list-label-pos 2:bottom --header-lines 3 --header-border sharp --header-label header --header-label-pos 2:bottom --query 1 --padding 1,2), :Enter + block = <<~BLOCK + │ ║ 12 + │ ║ 11 + │ ║ > 10 + │ ╚list════ + │ ┌──────── + │ │ 3 + │ │ 2 + │ │ 1 + │ └header── + │ 19/97 ─ + │ > 1 + │ + ╰──────────── + BLOCK + tmux.until { assert_block(block, _1) } + end + + def test_header_border_and_label_with_list_border_header_first + tmux.send_keys %(seq 100 | #{FZF} --border rounded --list-border double --list-label list --list-label-pos 2:bottom --header-lines 3 --header-border sharp --header-label header --header-label-pos 2:bottom --query 1 --padding 1,2 --header-first), :Enter + block = <<~BLOCK + │ ║ 12 + │ ║ 11 + │ ║ > 10 + │ ╚list════ + │ 19/97 ─ + │ > 1 + │ ┌──────── + │ │ 3 + │ │ 2 + │ │ 1 + │ └header── + │ + ╰──────────── + BLOCK + tmux.until { assert_block(block, _1) } + end + + def test_all_borders + tmux.send_keys %(seq 100 | #{FZF} --border rounded --list-border double --list-label list --list-label-pos 2:bottom --header-lines 3 --header-border sharp --header-label header --header-label-pos 2:bottom --query 1 --padding 1,2 --input-border bold --input-label input --input-label-pos 2:bottom), :Enter + block = <<~BLOCK + │ ║ 12 + │ ║ 11 + │ ║ > 10 + │ ╚list══════ + │ ┌────────── + │ │ 3 + │ │ 2 + │ │ 1 + │ └header──── + │ ┏━━━━━━━━━━ + │ ┃ 19/97 + │ ┃ > 1 + │ ┗input━━━━━ + │ + ╰────────────── + BLOCK + tmux.until { assert_block(block, _1) } + end + + def test_all_borders_header_first + tmux.send_keys %(seq 100 | #{FZF} --border rounded --list-border double --list-label list --list-label-pos 2:bottom --header-lines 3 --header-border sharp --header-label header --header-label-pos 2:bottom --query 1 --padding 1,2 --input-border bold --input-label input --input-label-pos 2:bottom --header-first), :Enter + block = <<~BLOCK + │ ║ 12 + │ ║ 11 + │ ║ > 10 + │ ╚list══════ + │ ┏━━━━━━━━━━ + │ ┃ 19/97 + │ ┃ > 1 + │ ┗input━━━━━ + │ ┌────────── + │ │ 3 + │ │ 2 + │ │ 1 + │ └header──── + │ + ╰────────────── BLOCK tmux.until { assert_block(block, _1) } end -- cgit v1.2.3