JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://raw.github.com/Wizek/Tree/master/dist/tree.js"></script>
JavaScript
tree.branch('This is an empty branch.', function(tree) {
tree.done(0)
})
tree.branch('Oh no, this fails!', function(tree) {
console.log(tree(1).is(1))
tree(1).like('1')
tree(1).is('1')
tree.branch('This is branch inside another.', function(tree) {
tree.done(0)
})
tree.branch("This is also nested. It's still running asyncronously. Notice how it doesn't block execution.", function(tree) {
tree.fireNextToo()
tree.timeout(99999)
})
tree.done(3)
})
tree.branch('// This one is commented out', function(tree) {
})
tree.branch('', function(tree) {
tree.timeout(10)
function neverRunsCallack (cb) {
//cb()
}
tree.branch('// Parent branch is Anonymous')
tree.branch('// It\'s timed out because tree.done() wasn\'t called in time.')
neverRunsCallack(function() {
tree.done(0)
})
})
tree.branch('This is a passing branch which contains some of the assert types.', function(tree) {
tree(1).is(1)
tree(1).like('1')
tree({a:{b:2}}).not.deepEql({a:{b:3}})
tree(1).throws()
tree(true).ok()
tree(false).not.ok()
tree().pass()
tree().not.fail()
tree([]).type('array')
tree.done(9)
})
tree.done(0)