Skip to content

Commit

Permalink
allow chaining on clear method. also a test
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Vallelonga committed Jul 10, 2014
1 parent 74b0710 commit 6bfb6f7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions ascii-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ AsciiTable.prototype.clear = function(name) {
} else if (toString.call(name) === '[object Object]') {
this.fromJSON(name)
}
return this
}

/**
Expand Down
14 changes: 14 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,20 @@ describe('Ascii Table v' + info.version, function() {
ase(table instanceof AsciiTable, true)
ase(table.getTitle(), 'title')
})

it('#factory with object', function() {
var obj = {
title: 'foo',
heading: ['id', 'name'],
rows: [
[1, 'bob'],
[2, 'jim']
]
}
var table = AsciiTable.factory(obj)
ase(table instanceof AsciiTable, true)
ase(table.getTitle(), 'foo')
})
})

describe('Instance methods', function() {
Expand Down

0 comments on commit 6bfb6f7

Please sign in to comment.