* Renders the top line of the cell. * @param drawRight - true if this method should render the right edge of the cell. * @returns {String}
(drawRight)
| 164 | * @returns {String} |
| 165 | */ |
| 166 | drawTop(drawRight) { |
| 167 | let content = []; |
| 168 | if (this.cells) { |
| 169 | //TODO: cells should always exist - some tests don't fill it in though |
| 170 | this.widths.forEach(function (width, index) { |
| 171 | content.push(this._topLeftChar(index)); |
| 172 | content.push(utils.repeat(this.chars[this.y == 0 ? 'top' : 'mid'], width)); |
| 173 | }, this); |
| 174 | } else { |
| 175 | content.push(this._topLeftChar(0)); |
| 176 | content.push(utils.repeat(this.chars[this.y == 0 ? 'top' : 'mid'], this.width)); |
| 177 | } |
| 178 | if (drawRight) { |
| 179 | content.push(this.chars[this.y == 0 ? 'topRight' : 'rightMid']); |
| 180 | } |
| 181 | return this.wrapWithStyleColors('border', content.join('')); |
| 182 | } |
| 183 | |
| 184 | _topLeftChar(offset) { |
| 185 | let x = this.x + offset; |
no test coverage detected