Skip to content

Commit

Permalink
Added browser generator files
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob Remeika committed Jun 20, 2011
1 parent a8913e9 commit c6a43b6
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 7 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -5,6 +5,7 @@
, "author" : "Bob Remeika"
, "version" : "0.0.7"
, "main" : "./src/adapters/node"
, "bin" : "./bin/foounit"
, "dependencies": {
"nomnom": ">=0.5.0"
}
Expand Down
4 changes: 2 additions & 2 deletions src/adapters/node.js
@@ -1,5 +1,5 @@
var foounit = require('../base')
, fsh = require('../../build/fsh')
var fsh = require('fsh')
, foounit = require('../base')
, colors = require('./node/colors')
, assert = require('./node/assert_patch');

Expand Down
2 changes: 1 addition & 1 deletion src/adapters/node/cli.js
Expand Up @@ -6,7 +6,7 @@ var parser = require('nomnom')
var TEMPLATE_DIR = pth.join(__dirname, '../../../templates');

function log(){
if (module.parent){ return; }
//if (module.parent){ return; }
console.log.apply(console, arguments);
}

Expand Down
Empty file added templates/browser-node/test.js
Empty file.
21 changes: 21 additions & 0 deletions templates/browser/example_spec.js
@@ -0,0 +1,21 @@
foounit.require(':spec/spec-helper');

// Include your source file here
// foounit.load(':src/example.js'); // loads a file in global scope
// foounit.require(':src/example.js'); // loads a file in functional scope

describe('this is a group', function (){
var foo;

before(function (){
foo = { bar: 123 };
});

it('fails', function (){
expect(foo.baz).toNot(beFalsy);
});

it('passes', function (){
expect(foo.bar).to(be, 123);
});
});
7 changes: 4 additions & 3 deletions templates/browser/runner.html
Expand Up @@ -74,8 +74,9 @@
.example:hover .topnav { visibility: visible; }
</style>

<script type="text/javascript" src="../../dist/foounit.js"></script>
<script type="text/javascript" src="../../dist/foounit-browser.js"></script>
<script type="text/javascript" src="../suite.js"></script>
<script type="text/javascript" src="foounit/foounit.js"></script>
<script type="text/javascript" src="foounit/foounit-browser.js"></script>
<script type="text/javascript" src="suite.js"></script>

</head>
</html>
1 change: 1 addition & 0 deletions templates/browser/spec-helper.js
@@ -0,0 +1 @@
foounit.globalize();
15 changes: 14 additions & 1 deletion templates/browser/suite.js
@@ -1 +1,14 @@
test
(function (foounit){

// Set __dirname if it doesn't exist (like in the browser)
__dirname = typeof __dirname !== 'undefined' ?
__dirname : foounit.browser.dirname(/suite.js$/);

// Change this to be a reference to your primary source directory
foounit.mount('src', __dirname + '/../src');
foounit.mount('spec', __dirname);

foounit.browser.setLoaderStrategy(new foounit.browser.XhrLoaderStrategy());
foounit.getSuite().addFile('example_spec');
foounit.getSuite().run();
})(foounit);

0 comments on commit c6a43b6

Please sign in to comment.