Skip to content
This repository has been archived by the owner on Jun 15, 2019. It is now read-only.

Commit

Permalink
fix styling of empty lines
Browse files Browse the repository at this point in the history
  • Loading branch information
jamestalmage committed Dec 19, 2014
1 parent 6a4c0ee commit 5addc3e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down Expand Up @@ -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);
};

/**
Expand Down
14 changes: 14 additions & 0 deletions test/cell-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5addc3e

Please sign in to comment.