Browse files

Added `make test-docs`

  • Loading branch information...
1 parent d582f7b commit 18e563fcf1bd45eea3f43c5e829ecc7ecb3ae1dc @tj tj committed Dec 22, 2011
Showing with 47 additions and 3 deletions.
  1. +5 −2 Makefile
  2. +39 −0 docs/head.html
  3. +2 −0 docs/tail.html
  4. +1 −1 test/node/basic.js
View
7 Makefile
@@ -22,9 +22,12 @@ superagent.min.js: superagent.js
test-server:
@node test/server
-docs: lib
+docs: lib test-docs
+
+test-docs:
+ make test REPORTER=doc | cat docs/head.html - cat docs/tail.html > docs/test.html
clean:
rm -f superagent{,.min}.js
-.PHONY: test docs clean
+.PHONY: test docs test-docs clean
View
39 docs/head.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Superagent</title>
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
+ <style>
+ body {
+ font: 16px/1.6 "Helvetica Neue", arial, sans-serif;
+ padding: 60px;
+ }
+ pre { font-size: 14px; line-height: 1.3 }
+ code .init { color: #2F6FAD }
+ code .string { color: #5890AD }
+ code .keyword { color: #8A6343 }
+ code .number { color: #2F6FAD }
+ </style>
+ <script>
+ $(function(){
+ $('code').each(function(){
+ $(this).html(highlight($(this).text()));
+ });
+ });
+
+ function highlight(js) {
+ return js
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;')
+ .replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>')
+ .replace(/('.*')/gm, '<span class="string">$1</span>')
+ .replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
+ .replace(/(\d+)/gm, '<span class="number">$1</span>')
+ .replace(/\bnew *(\w+)/gm, '<span class="keyword">new</span> <span class="init">$1</span>')
+ .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '<span class="keyword">$1</span>')
+ }
+ </script>
+ </head>
+ <body>
+ <h1>Superagent</h1>
+ <p>The superagent test suite.</p>
View
2 docs/tail.html
@@ -0,0 +1,2 @@
+ </body>
+</html>
View
2 test/node/basic.js
@@ -202,7 +202,7 @@ describe('request', function(){
})
})
- describe('req.send(obj)', function(){
+ describe('req.send(Object)', function(){
it('should default to json', function(done){
request
.post('http://localhost:3000/echo')

0 comments on commit 18e563f

Please sign in to comment.