@@ -275,6 +275,53 @@ describe("Table", () => {
275275 expect ( result ) . toMatchSnapshot ( ) ;
276276 } ) ;
277277
278+ it ( "Table with a single column filled." , ( ) => {
279+ const headers = [ "Name" , "Constraint type" , "Default type" ] ;
280+ const rows = [
281+ [ "TValue" , "" , "" ]
282+ ] ;
283+
284+ const result = MarkdownGenerator . Table ( headers , rows , { removeColumnIfEmpty : true } ) ;
285+ expect ( result ) . toMatchSnapshot ( ) ;
286+ } ) ;
287+
288+ it ( "Table with an empty column in the middle." , ( ) => {
289+ const headers = [ "Name" , "Constraint type" , "Default type" ] ;
290+ const rows = [
291+ [ "TValue" , "" , "string" ] ,
292+ [ "T" , "" , "string" ] ,
293+ [ "TKey " , "" , "string" ] ,
294+ ] ;
295+
296+ const result = MarkdownGenerator . Table ( headers , rows , { removeColumnIfEmpty : true } ) ;
297+ expect ( result ) . toMatchSnapshot ( ) ;
298+ } ) ;
299+
300+ it ( "Table with empty rows" , ( ) => {
301+ const headers = [ "Name" , "Constraint type" , "Default type" , "InitialValue" ] ;
302+ const rows = [
303+ [ "TValue" , "" , "" , "{}" ] ,
304+ [ "" , "" , "" , "" ] ,
305+ [ "TKey" , "" , "" , "{}" ] ,
306+ [ "" , "" , "" , "" ]
307+ ] ;
308+
309+ const result = MarkdownGenerator . Table ( headers , rows , { removeColumnIfEmpty : true , removeRowIfEmpty : true } ) ;
310+ expect ( result ) . toMatchSnapshot ( ) ;
311+ } ) ;
312+
313+ it ( "Table with rows that has a single cell filled" , ( ) => {
314+ const headers = [ "Name" , "Constraint type" , "Default type" , "InitialValue" ] ;
315+ const rows = [
316+ [ "TValue" , "" , "" , "" ] ,
317+ [ "" , "Object" , "" , "" ] ,
318+ [ "" , "" , "Object" , "" ] ,
319+ [ "" , "" , "" , "{}" ]
320+ ] ;
321+
322+ const result = MarkdownGenerator . Table ( headers , rows , { removeColumnIfEmpty : true } ) ;
323+ } ) ;
324+
278325 it ( "Simple example with mixed alignments" , ( ) => {
279326 const headers : Array < TableHeader | string > = [
280327 {
0 commit comments