Created
May 10, 2012 21:02
-
-
Save kmiyashiro/2655876 to your computer and use it in GitHub Desktop.
Mocha HTML spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
<link rel="stylesheet" href="../libs/mocha.css" type="text/css" media="screen" title="no title" charset="utf-8"> | |
</head> | |
<body> | |
<div id="mocha"></div> | |
<script src="../libs/mocha.js" type="text/javascript" charset="utf-8"></script> | |
<script src="../libs/sinon.js" type="text/javascript" charset="utf-8"></script> | |
<!-- Common config --> | |
<script src="../config.js" type="text/javascript" charset="utf-8"></script> | |
<!-- Admin config --> | |
<script src="config.js" type="text/javascript" charset="utf-8"></script> | |
<script src="../../js/libs/require/require.js" type="text/javascript" charset="utf-8"></script> | |
<script src="../spec-helpers.js" type="text/javascript" charset="utf-8"></script> | |
<script type="text/javascript" charset="utf-8"> | |
require([ | |
'specs/app.js', | |
'specs/configBundle.js', | |
'specs/device.js', | |
'specs/email.js', | |
'specs/group.js', | |
'specs/map.js', | |
'specs/modal.js', | |
'specs/policy.js', | |
'specs/user.js', | |
'specs/util.js' | |
], runMocha); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(function(require) { | |
var UploadApp = require('view/apps/uploadAppDialog'), | |
modalShared = require('../shared/modal.js'); | |
describe('App', function() { | |
describe('Model', function() { | |
}); | |
describe('Collection', function() { | |
}); | |
describe('Views', function() { | |
describe('Upload App', function() { | |
before(function() { | |
this.view = new UploadApp(); | |
// This disables the animation, which breaks during the test. | |
// Most likely because it requires CSS | |
this.view.$el.removeClass('fade'); | |
}); | |
after(function() { | |
this.view.close({ remove: true }); | |
this.view = undefined; | |
}); | |
modalShared(); | |
}); | |
}); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Include and setup all the stuff for testing | |
define(function(require) { | |
window.$ = window.jQuery = require('jquery'); | |
window.chai = require('chai'); | |
window.expect = chai.expect; | |
window.assert = chai.assert; | |
window.sinonChai = require('sinon-chai'); // Buggy as hell right now | |
window.jqueryChai = require('chai-jquery'); | |
chai.use(sinonChai); | |
chai.use(jqueryChai); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Partial config file | |
var require = { | |
// Base URL relative to the test runner | |
// Paths are relative to this | |
baseUrl: '../../js/', | |
paths: { | |
// Testing libs | |
'chai' : '../test/libs/chai', | |
'sinon-chai' : '../test/libs/sinon-chai', | |
'chai-jquery' : '../test/libs/chai-jquery', | |
'common' : '../test/libs/common', | |
'fixtures' : '../test/admin/fixtures/fixtures', | |
'jquery' : 'libs/jquery/jquery.min', | |
'underscore' : 'libs/underscore/underscore', | |
'backbone' : 'vendor/backbone', | |
'visualsearch' : 'libs/backbone/visualsearch', | |
'highcharts' : 'libs/highcharts/highcharts', | |
'charts' : 'vendor/highcharts', | |
'templates' : 'templates/templates' | |
}, | |
use: { | |
backbone: { | |
deps: ['use!underscore', 'jquery'], | |
attach: 'Backbone' | |
}, | |
'libs/backbone/backbone': { | |
deps: ['use!underscore', 'jquery'], | |
attach: 'Backbone' | |
}, | |
'libs/leaflet/leaflet-src': { | |
attach: 'L' | |
}, | |
underscore: { | |
attach: '_' | |
}, | |
mocha: { | |
attach: 'mocha' | |
} | |
}, | |
priority: [ | |
'jquery', | |
'underscore', | |
'common' | |
] | |
// urlArgs: /debug\=1/.test(window.location.search) ? '' : 'bust=' + (new Date()).getTime(), // debug | |
}; | |
// You can do this in the grunt config for each mocha task, see the `options` config | |
mocha.setup({ | |
ui: 'bdd', | |
ignoreLeaks: true | |
}); | |
// Protect from barfs | |
console = window.console || function() {}; | |
// Don't track | |
window.notrack = true; | |
// Mocha run helper, used for browser | |
var runMocha = function() { | |
mocha.run(); | |
}; |
oh yah
Please, can you provide the GruntFile along the other files?
Thanks a lot.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey man, might be good to update this to reflect shim instead of use.js; really useful reference!