File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
System.CommandLine.Rendering.Tests
System.CommandLine.Rendering Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -17,5 +17,14 @@ public void Container_span_supports_add_method()
17
17
18
18
span . ContentLength . Should ( ) . Be ( "content with child" . Length ) ;
19
19
}
20
+
21
+ [ Fact ]
22
+ public void Container_span_supports_add_string_method ( )
23
+ {
24
+ var span = new ContainerSpan ( new ContentSpan ( "content" ) ) ;
25
+ span . Add ( " with string" ) ;
26
+
27
+ span . ContentLength . Should ( ) . Be ( "content with string" . Length ) ;
28
+ }
20
29
}
21
30
}
Original file line number Diff line number Diff line change @@ -72,5 +72,17 @@ public void Add(TextSpan child)
72
72
73
73
RecalculateChildPositions ( ) ;
74
74
}
75
+
76
+ public void Add ( string text )
77
+ {
78
+ if ( string . IsNullOrEmpty ( text ) )
79
+ {
80
+ return ;
81
+ }
82
+
83
+ _children . Add ( new ContentSpan ( text ) ) ;
84
+
85
+ RecalculateChildPositions ( ) ;
86
+ }
75
87
}
76
88
}
You can’t perform that action at this time.
0 commit comments