@@ -291,6 +291,7 @@ func TestModel_RenderRow(t *testing.T) {
291291func TestTableAlignment (t * testing.T ) {
292292 t .Run ("No border" , func (t * testing.T ) {
293293 biscuits := New (
294+ WithWidth (59 ),
294295 WithHeight (5 ),
295296 WithColumns ([]Column {
296297 {Title : "Name" , Width : 25 },
@@ -319,6 +320,7 @@ func TestTableAlignment(t *testing.T) {
319320 Bold (false )
320321
321322 biscuits := New (
323+ WithWidth (59 ),
322324 WithHeight (5 ),
323325 WithColumns ([]Column {
324326 {Title : "Name" , Width : 25 },
@@ -515,15 +517,19 @@ func TestModel_View(t *testing.T) {
515517 modelFunc func () Model
516518 skip bool
517519 }{
518- // TODO(?): should the view/output of empty tables use the same default height? (this has height 21)
519520 "Empty" : {
520521 modelFunc : func () Model {
521- return New ()
522+ return New (
523+ WithWidth (60 ),
524+ WithHeight (21 ),
525+ )
522526 },
523527 },
524528 "Single row and column" : {
525529 modelFunc : func () Model {
526530 return New (
531+ WithWidth (27 ),
532+ WithHeight (21 ),
527533 WithColumns ([]Column {
528534 {Title : "Name" , Width : 25 },
529535 }),
@@ -536,6 +542,8 @@ func TestModel_View(t *testing.T) {
536542 "Multiple rows and columns" : {
537543 modelFunc : func () Model {
538544 return New (
545+ WithWidth (59 ),
546+ WithHeight (21 ),
539547 WithColumns ([]Column {
540548 {Title : "Name" , Width : 25 },
541549 {Title : "Country of Origin" , Width : 16 },
@@ -557,6 +565,7 @@ func TestModel_View(t *testing.T) {
557565 s .Cell = lipgloss .NewStyle ().Padding (2 , 2 )
558566
559567 return New (
568+ WithWidth (60 ),
560569 WithHeight (10 ),
561570 WithColumns ([]Column {
562571 {Title : "Name" , Width : 25 },
@@ -579,6 +588,7 @@ func TestModel_View(t *testing.T) {
579588 s .Cell = lipgloss .NewStyle ()
580589
581590 return New (
591+ WithWidth (53 ),
582592 WithHeight (10 ),
583593 WithColumns ([]Column {
584594 {Title : "Name" , Width : 25 },
@@ -594,10 +604,12 @@ func TestModel_View(t *testing.T) {
594604 )
595605 },
596606 },
597- // TODO(?): the total height is modified with borderd headers, however not with bordered cells. Is this expected/desired?
607+ // TODO(?): the total height is modified with bordered headers, however not with bordered cells. Is this expected/desired?
598608 "Bordered headers" : {
599609 modelFunc : func () Model {
600610 return New (
611+ WithWidth (59 ),
612+ WithHeight (23 ),
601613 WithColumns ([]Column {
602614 {Title : "Name" , Width : 25 },
603615 {Title : "Country of Origin" , Width : 16 },
@@ -618,6 +630,8 @@ func TestModel_View(t *testing.T) {
618630 "Bordered cells" : {
619631 modelFunc : func () Model {
620632 return New (
633+ WithWidth (59 ),
634+ WithHeight (21 ),
621635 WithColumns ([]Column {
622636 {Title : "Name" , Width : 25 },
623637 {Title : "Country of Origin" , Width : 16 },
@@ -634,9 +648,10 @@ func TestModel_View(t *testing.T) {
634648 )
635649 },
636650 },
637- "Manual height greater than rows" : {
651+ "Height greater than rows" : {
638652 modelFunc : func () Model {
639653 return New (
654+ WithWidth (59 ),
640655 WithHeight (6 ),
641656 WithColumns ([]Column {
642657 {Title : "Name" , Width : 25 },
@@ -651,9 +666,10 @@ func TestModel_View(t *testing.T) {
651666 )
652667 },
653668 },
654- "Manual height less than rows" : {
669+ "Height less than rows" : {
655670 modelFunc : func () Model {
656671 return New (
672+ WithWidth (59 ),
657673 WithHeight (2 ),
658674 WithColumns ([]Column {
659675 {Title : "Name" , Width : 25 },
@@ -669,10 +685,11 @@ func TestModel_View(t *testing.T) {
669685 },
670686 },
671687 // TODO(fix): spaces are added to the right of the viewport to fill the width, but the headers end as though they are not aware of the width.
672- "Manual width greater than columns" : {
688+ "Width greater than columns" : {
673689 modelFunc : func () Model {
674690 return New (
675691 WithWidth (80 ),
692+ WithHeight (21 ),
676693 WithColumns ([]Column {
677694 {Title : "Name" , Width : 25 },
678695 {Title : "Country of Origin" , Width : 16 },
@@ -688,10 +705,11 @@ func TestModel_View(t *testing.T) {
688705 },
689706 // TODO(fix): Setting the table width does not affect the total headers' width. Cells are wrapped.
690707 // Headers are not affected. Truncation/resizing should match lipgloss.table functionality.
691- "Manual width less than columns" : {
708+ "Width less than columns" : {
692709 modelFunc : func () Model {
693710 return New (
694711 WithWidth (30 ),
712+ WithHeight (15 ),
695713 WithColumns ([]Column {
696714 {Title : "Name" , Width : 25 },
697715 {Title : "Country of Origin" , Width : 16 },
@@ -709,6 +727,8 @@ func TestModel_View(t *testing.T) {
709727 "Modified viewport height" : {
710728 modelFunc : func () Model {
711729 m := New (
730+ WithWidth (59 ),
731+ WithHeight (15 ),
712732 WithColumns ([]Column {
713733 {Title : "Name" , Width : 25 },
714734 {Title : "Country of Origin" , Width : 16 },
0 commit comments