Skip to content

Commit

Permalink
First commit!
Browse files Browse the repository at this point in the history
  • Loading branch information
airportyh committed May 7, 2011
0 parents commit 87aba75
Show file tree
Hide file tree
Showing 17 changed files with 5,306 additions and 0 deletions.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Tutti Code Examples
===================
These are the code examples I used in the Tutti demo at JSConf 2011 in Portland. To run these examples, first make sure you have the prerequisite software installed:

1. [node.js](http://nodejs.org/)
2. [npm](http://npmjs.org/)
3. tutti npm package (installed via `npm install tutti`, `sudo` may be required depending on your installation of npm)

Next, go to <http://tuttijs.com> and create a room. Copy the URL when you've entered the room, and paste it into the places in the scripts where it says 'PASTE ROOM URL HERE'.

There are three examples: `testing`, `autotest`, and `feature_detection`. Here's how to run the scripts for each example:

### Testing

cd testing
# edit runTests.js to substitute room URL
node runTests.js

### Autotest

cd autotest
# edit runTests.js to substitute room URL
node runTests.js
# now you need to actually edit the map.js and testMap.js files and save
# them to trigger a re-run of the tests.

### Feature Detection(generate a browser feature comparison table)

cd feature_detection
# edit features.js to substitute room URL
./features.sh
open features.html

I hope these instructions are sufficient to get it going for you. If not, ping me on twitter: @airportyh.

47 changes: 47 additions & 0 deletions autotest/consoleJasmineReporter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
(function(){

function red(s){ return ["\033[31m", s, "\033[0m"].join('') }
function green(s){ return ["\033[32m", s, "\033[0m"].join('') }
function cyan(s){ return ["\033[36m", s, "\033[0m"].join('') }
function yellow(s){ return ["\033[33m", s, "\033[0m"].join('') }
function blue(s){ return ["\033[34m", s, "\033[0m"].join('') }

function ConsoleJasmineReporter(){
}

ConsoleJasmineReporter.prototype.reportRunnerResults = function(runner){
var output = [],
results = runner.results(),
specs = runner.specs()
var msg = [specs.length, 'specs,', results.failedCount, 'failures.'].join(' ')
if (results.failedCount > 0)
msg = red(msg)
else
msg = green(msg)
output.push(msg)


for (var i = 0; i < specs.length; i++) {
var spec = specs[i]
var results = spec.results()
if (results.failedCount > 0){
var items = results.getItems()
var numItems = items.length
for (var j = 0; j < numItems; j++){
var result = items[j]
if (result.type == 'log')
output.push(' LOG: ' + result.toString())
else if (result.type == 'expect' &&
result.passed && !result.passed()){
output.push(spec.getFullName())
output.push(' ' + red(result.message))
}
}
}
}
console.log(output.join('\n'))
}

window.ConsoleJasmineReporter = ConsoleJasmineReporter

}())
Loading

0 comments on commit 87aba75

Please sign in to comment.