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

Commit

Permalink
uploading screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
jamestalmage committed Dec 19, 2014
1 parent 5a960a0 commit 240cb0e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
Binary file added examples/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/examples.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var Table = require('../src/table');
var colors = require('colors/safe');

module.exports = function(runTest) {
module.exports = function(runTest,screenshot) {

function it(name,fn) {
var result = fn();
Expand Down
Binary file added examples/screenshots/truncation-with-colors.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 9 additions & 4 deletions lib/print-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var expect = chai.expect;
var colors = require('colors/safe');
var fs = require('fs');

function runExample(fn,logName,logTable,logCode,logSeparator){
function runExample(fn,logName,logTable,logCode,logSeparator,screenshot){
function printExample(name,makeTable,expected){
var code = makeTable.toString().split('\n').slice(1,-2).join('\n');

Expand All @@ -14,7 +14,7 @@ function runExample(fn,logName,logTable,logCode,logSeparator){
logSeparator('\n');
}

fn(printExample);
fn(printExample,screenshot);
}

function logExample(fn){
Expand All @@ -24,14 +24,19 @@ function logExample(fn){
},
console.log,
console.log,
console.log
console.log,
identity
)
}

function stripColors(str){
return str.split( /\u001b\[(?:\d*;){0,5}\d*m/g).join('');
}

function identity(str){
return str;
}

function mdExample(fn,file){
var buffer = [];

Expand Down Expand Up @@ -65,7 +70,7 @@ function testExample(name,fn,expected){

function runTest(fn){
describe('@api Table', function () {
fn(testExample);
fn(testExample,identity);
});
}

Expand Down

0 comments on commit 240cb0e

Please sign in to comment.