summaryrefslogtreecommitdiffstats
path: root/zellij-server
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2023-03-30 18:04:47 +0200
committerGitHub <noreply@github.com>2023-03-30 18:04:47 +0200
commit30374d4ede2e170734c2ccb6fc2641e4f686b9de (patch)
tree4d19be33bca7a3cddd377dbe63dd8f331f49c7e5 /zellij-server
parent55a2f4915e56970d26008fbea7b205f52be0ef85 (diff)
fix(layouts): nested attribute truncating (#2337)
Diffstat (limited to 'zellij-server')
-rw-r--r--zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__when_applying_a_truncated_swap_layout_child_attributes_are_not_ignored.snap26
-rw-r--r--zellij-server/src/tab/unit/tab_integration_tests.rs34
2 files changed, 60 insertions, 0 deletions
diff --git a/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__when_applying_a_truncated_swap_layout_child_attributes_are_not_ignored.snap b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__when_applying_a_truncated_swap_layout_child_attributes_are_not_ignored.snap
new file mode 100644
index 000000000..56396fe81
--- /dev/null
+++ b/zellij-server/src/tab/unit/snapshots/zellij_server__tab__tab_integration_tests__when_applying_a_truncated_swap_layout_child_attributes_are_not_ignored.snap
@@ -0,0 +1,26 @@
+---
+source: zellij-server/src/tab/./unit/tab_integration_tests.rs
+assertion_line: 6791
+expression: snapshot
+---
+00 (C):
+01 (C):
+02 (C):
+03 (C):
+04 (C):
+05 (C):
+06 (C):
+07 (C):
+08 (C):
+09 (C):
+10 (C):
+11 (C):
+12 (C):
+13 (C):
+14 (C):
+15 (C):
+16 (C):
+17 (C):
+18 (C):
+19 (C):
+
diff --git a/zellij-server/src/tab/unit/tab_integration_tests.rs b/zellij-server/src/tab/unit/tab_integration_tests.rs
index 13ab67104..d7556eed4 100644
--- a/zellij-server/src/tab/unit/tab_integration_tests.rs
+++ b/zellij-server/src/tab/unit/tab_integration_tests.rs
@@ -6759,3 +6759,37 @@ fn when_resizing_whole_tab_with_auto_layout_and_floating_panes_the_layout_is_mai
);
assert_snapshot!(snapshot);
}
+
+#[test]
+fn when_applying_a_truncated_swap_layout_child_attributes_are_not_ignored() {
+ // here we want to make sure that the nested borderless is preserved on resize (when the layout
+ // is reapplied, and thus is truncated to just one pane rather than a logical container pane
+ // and an actual pane as it is described here)
+ let layout = r#"
+ layout {
+ pane {
+ pane borderless=true
+ }
+ }
+ "#;
+ let size = Size {
+ cols: 121,
+ rows: 20,
+ };
+ let client_id = 1;
+ let mut tab = create_new_tab_with_layout(size, ModeInfo::default(), layout);
+ let mut output = Output::default();
+ let new_size = Size {
+ cols: 122,
+ rows: 20,
+ };
+ let _ = tab.resize_whole_tab(new_size);
+ tab.render(&mut output, None).unwrap();
+ let snapshot = take_snapshot(
+ output.serialize().unwrap().get(&client_id).unwrap(),
+ new_size.rows,
+ new_size.cols,
+ Palette::default(),
+ );
+ assert_snapshot!(snapshot);
+}