diff options
| author | Aram Drevekenin <aram@poor.dev> | 2024-12-31 12:37:23 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-31 12:37:23 +0100 |
| commit | 42adc8cd048c03d52a9f33503d75e24364adbc68 (patch) | |
| tree | 943ee11e188e6512b336b603bdd5ea8eae38998b /zellij-server/src/unit | |
| parent | docs(changelog): cursor overflow fix (diff) | |
| download | sl0ppij-42adc8cd048c03d52a9f33503d75e24364adbc68.tar.gz sl0ppij-42adc8cd048c03d52a9f33503d75e24364adbc68.tar.xz sl0ppij-42adc8cd048c03d52a9f33503d75e24364adbc68.zip | |
feat(ux): stack panes command (#3905)
* working across tabs and floating panes through the cli
* finalize cli command
* plugin api
* style(fmt): rustfmt
* fix: re-focus pane in stack if it was focused
* style(fmt): rustfmt
* remove outdated comment
Diffstat (limited to 'zellij-server/src/unit')
4 files changed, 78 insertions, 0 deletions
diff --git a/zellij-server/src/unit/screen_tests.rs b/zellij-server/src/unit/screen_tests.rs index 38140b04..d4b9e916 100644 --- a/zellij-server/src/unit/screen_tests.rs +++ b/zellij-server/src/unit/screen_tests.rs @@ -3647,3 +3647,43 @@ pub fn screen_can_move_pane_to_a_new_tab_left() { } assert_snapshot!(format!("{}", snapshot_count)); } + +#[test] +pub fn send_cli_stack_panes_action() { + let size = Size { cols: 80, rows: 10 }; + let client_id = 10; // fake client id should not appear in the screen's state + let mut initial_layout = TiledPaneLayout::default(); + initial_layout.children_split_direction = SplitDirection::Vertical; + initial_layout.children = vec![ + TiledPaneLayout::default(), + TiledPaneLayout::default(), + TiledPaneLayout::default(), + TiledPaneLayout::default(), + TiledPaneLayout::default(), + ]; + let mut mock_screen = MockScreen::new(size); + let session_metadata = mock_screen.clone_session_metadata(); + let screen_thread = mock_screen.run(Some(initial_layout), vec![]); + let received_server_instructions = Arc::new(Mutex::new(vec![])); + let server_receiver = mock_screen.server_receiver.take().unwrap(); + let server_thread = log_actions_in_thread!( + received_server_instructions, + ServerInstruction::KillSession, + server_receiver + ); + let stack_panes_action = CliAction::StackPanes { + pane_ids: vec!["1".to_owned(), "2".to_owned(), "3".to_owned()], + }; + send_cli_action_to_server(&session_metadata, stack_panes_action, client_id); + std::thread::sleep(std::time::Duration::from_millis(100)); + mock_screen.teardown(vec![server_thread, screen_thread]); + let snapshots = take_snapshots_and_cursor_coordinates_from_render_events( + received_server_instructions.lock().unwrap().iter(), + size, + ); + let snapshot_count = snapshots.len(); + for (_cursor_coordinates, snapshot) in snapshots { + assert_snapshot!(format!("{}", snapshot)); + } + assert_snapshot!(format!("{}", snapshot_count)); +} diff --git a/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_stack_panes_action-2.snap b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_stack_panes_action-2.snap new file mode 100644 index 00000000..c26d308f --- /dev/null +++ b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_stack_panes_action-2.snap @@ -0,0 +1,16 @@ +--- +source: zellij-server/src/./unit/screen_tests.rs +assertion_line: 3687 +expression: "format!(\"{}\", snapshot)" +--- +00 (C): ┌ Pane #1 ─────┐┌ Pane #2 ─────────────────────────────────────┐┌ Pane #5 ─────┐ +01 (C): │ │┌ Pane #3 ─────────────────────────────────────┐│ │ +02 (C): │ │┌ Pane #4 ─────────────────────────────────────┐│ │ +03 (C): │ ││ ││ │ +04 (C): │ ││ ││ │ +05 (C): │ ││ ││ │ +06 (C): │ ││ ││ │ +07 (C): │ ││ ││ │ +08 (C): │ ││ ││ │ +09 (C): └──────────────┘└──────────────────────────────────────────────┘└──────────────┘ + diff --git a/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_stack_panes_action-3.snap b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_stack_panes_action-3.snap new file mode 100644 index 00000000..6329f4de --- /dev/null +++ b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_stack_panes_action-3.snap @@ -0,0 +1,6 @@ +--- +source: zellij-server/src/./unit/screen_tests.rs +assertion_line: 3689 +expression: "format!(\"{}\", snapshot_count)" +--- +2 diff --git a/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_stack_panes_action.snap b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_stack_panes_action.snap new file mode 100644 index 00000000..8b57c658 --- /dev/null +++ b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__send_cli_stack_panes_action.snap @@ -0,0 +1,16 @@ +--- +source: zellij-server/src/./unit/screen_tests.rs +assertion_line: 3687 +expression: "format!(\"{}\", snapshot)" +--- +00 (C): ┌ Pane #1 ─────┐┌ Pane #2 ─────┐┌ Pane #3 ─────┐┌ Pane #4 ─────┐┌ Pane #5 ─────┐ +01 (C): │ ││ ││ ││ ││ │ +02 (C): │ ││ ││ ││ ││ │ +03 (C): │ ││ ││ ││ ││ │ +04 (C): │ ││ ││ ││ ││ │ +05 (C): │ ││ ││ ││ ││ │ +06 (C): │ ││ ││ ││ ││ │ +07 (C): │ ││ ││ ││ ││ │ +08 (C): │ ││ ││ ││ ││ │ +09 (C): └──────────────┘└──────────────┘└──────────────┘└──────────────┘└──────────────┘ + |
