aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/input/unit/layout_test.rs
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2023-02-25 11:16:11 +0100
committerGitHub <noreply@github.com>2023-02-25 11:16:11 +0100
commit5bcc1bb382659da60f29e4fc79336d3f6a727b57 (patch)
treee54fed009064e6d10d630c2c80070873f6a1fce6 /zellij-utils/src/input/unit/layout_test.rs
parentdocs(bug-report): update bug_report.md template with OSX log directory (#2181) (diff)
downloadsl0ppij-5bcc1bb382659da60f29e4fc79336d3f6a727b57.tar.gz
sl0ppij-5bcc1bb382659da60f29e4fc79336d3f6a727b57.tar.xz
sl0ppij-5bcc1bb382659da60f29e4fc79336d3f6a727b57.zip
fix(layout): various parser and ui fixes (#2191)
* fix(layout): error on nodes outside layout node * fix(layout): move stacked property to pane * fix(layout): various stack exceptions * fix(ui): non-flexible stacked pane titles now take up their full length * fix(ui): stack titles with no-pane-frames take up their proper length * style(fmt): rustfmt
Diffstat (limited to 'zellij-utils/src/input/unit/layout_test.rs')
-rw-r--r--zellij-utils/src/input/unit/layout_test.rs93
1 files changed, 93 insertions, 0 deletions
diff --git a/zellij-utils/src/input/unit/layout_test.rs b/zellij-utils/src/input/unit/layout_test.rs
index f15fd709..670273b0 100644
--- a/zellij-utils/src/input/unit/layout_test.rs
+++ b/zellij-utils/src/input/unit/layout_test.rs
@@ -1849,3 +1849,96 @@ fn can_load_swap_layouts_from_a_different_file() {
.unwrap();
assert_snapshot!(format!("{:#?}", layout));
}
+
+#[test]
+fn can_define_stacked_children_for_pane_node() {
+ let kdl_layout = r#"
+ layout {
+ pane stacked=true {
+ pane
+ pane
+ }
+ }
+ "#;
+ let layout = Layout::from_kdl(kdl_layout, "layout_file_name".into(), None, None).unwrap();
+ assert_snapshot!(format!("{:#?}", layout));
+}
+
+#[test]
+fn can_define_stacked_children_for_pane_template() {
+ let kdl_layout = r#"
+ layout {
+ pane_template name="stack" stacked=true {
+ children
+ }
+ stack {
+ pane
+ pane
+ }
+ }
+ "#;
+ let layout = Layout::from_kdl(kdl_layout, "layout_file_name".into(), None, None).unwrap();
+ assert_snapshot!(format!("{:#?}", layout));
+}
+
+#[test]
+fn cannot_define_stacked_panes_for_bare_node() {
+ let kdl_layout = r#"
+ layout {
+ pane stacked=true
+ }
+ "#;
+ let layout = Layout::from_kdl(kdl_layout, "layout_file_name".into(), None, None);
+ assert!(layout.is_err(), "error provided for tab name with space");
+}
+
+#[test]
+fn cannot_define_stacked_panes_with_vertical_split_direction() {
+ let kdl_layout = r#"
+ layout {
+ pane stacked=true split_direction="vertical" {
+ pane
+ pane
+ }
+ }
+ "#;
+ let layout = Layout::from_kdl(kdl_layout, "layout_file_name".into(), None, None);
+ assert!(layout.is_err(), "error provided for tab name with space");
+}
+
+#[test]
+fn cannot_define_stacked_panes_with_grandchildren() {
+ let kdl_layout = r#"
+ layout {
+ pane stacked=true {
+ pane {
+ pane
+ pane
+ }
+ pane
+ }
+ }
+ "#;
+ let layout = Layout::from_kdl(kdl_layout, "layout_file_name".into(), None, None);
+ assert!(layout.is_err(), "error provided for tab name with space");
+}
+
+#[test]
+fn cannot_define_stacked_panes_with_grandchildren_in_pane_template() {
+ let kdl_layout = r#"
+ layout {
+ pane_template name="stack" stacked=true {
+ children
+ }
+ stack {
+ pane
+ pane {
+ pane
+ pane
+ }
+ }
+ }
+ "#;
+ let layout = Layout::from_kdl(kdl_layout, "layout_file_name".into(), None, None);
+ assert!(layout.is_err(), "error provided for tab name with space");
+}