From 5addc3e011db320618632aae1ca68994760ea1ed Mon Sep 17 00:00:00 2001 From: James Talmage Date: Fri, 19 Dec 2014 00:19:35 -0500 Subject: [PATCH] fix styling of empty lines --- src/cell.js | 6 +++++- test/cell-test.js | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/cell.js b/src/cell.js index 4798c31..cf31f26 100644 --- a/src/cell.js +++ b/src/cell.js @@ -202,6 +202,10 @@ Cell.prototype.drawLine = function(lineNum,drawRight,forceTruncationSymbol,spann var content = utils.truncate(line,len,this.truncate); content = utils.pad(content, len, ' ', this.hAlign); content = leftPadding + content + rightPadding; + return this.stylizeLine(left,content,right); +}; + +Cell.prototype.stylizeLine = function(left,content,right){ left = this.wrapWithStyleColors('border',left); right = this.wrapWithStyleColors('border',right); if(this.y === 0){ @@ -240,7 +244,7 @@ Cell.prototype.drawEmpty = function(drawRight,spanningCell){ } var right = (drawRight ? this.chars['right'] : ''); var content = utils.repeat(' ',this.width); - return left + content + right; + return this.stylizeLine(left , content , right); }; /** diff --git a/test/cell-test.js b/test/cell-test.js index ce01fb5..df78a5d 100644 --- a/test/cell-test.js +++ b/test/cell-test.js @@ -554,6 +554,20 @@ describe('Cell',function(){ }); }); + describe('drawBottom',function(){ + it('draws an empty line',function(){ + expect(cell.drawEmpty()).to.equal('L '); + expect(cell.drawEmpty(true)).to.equal('L R'); + }); + + it('draws an empty line',function(){ + cell.border = ['gray']; + cell.head = ['red']; + expect(cell.drawEmpty()).to.equal(colors.gray('L') + colors.red(' ')); + expect(cell.drawEmpty(true)).to.equal(colors.gray('L') + colors.red(' ') + colors.gray('R')); + }); + }); + describe('first line of text',function(){ beforeEach(function () { cell.width = 9;