Skip to content

Instantly share code, notes, and snippets.

@daffl
Last active April 20, 2017 12:14
Show Gist options
  • Save daffl/aecee98d107980aac586 to your computer and use it in GitHub Desktop.
Save daffl/aecee98d107980aac586 to your computer and use it in GitHub Desktop.
Mocha + FuncUnit
{
"name": "funcunit-dmeo",
"version": "0.0.0",
"main": "lib/index.js",
"license": "ISC",
"private": true,
"devDependencies": {
"mocha": "~1.15.0",
"chai": "~1.8.1",
"funcunit": "git://github.com/bitovi/funcunit.git#abeedf7e7e75445e0ef6bb82a8cef250664d4c67"
}
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="../bower_components/mocha/mocha.css" />
<title>FuncUnit Mocha tests</title>
</head>
<body>
<div id="mocha"></div>
<div id="page">
<div id="test-area"></div>
</div>
<script src="../bower_components/funcunit/dist/funcunit.js"></script>
<script src="../bower_components/mocha/mocha.js"></script>
<script src="../bower_components/chai/chai.js"></script>
<script src="app/component.js"></script>
<script src="app/test.js"></script>
<script type="text/javascript">
mocha.setup('bdd');
mocha.timeout(10000);
mocha.run();
</script>
</body>
</html>
describe('<my-component>', function() {
beforeEach(function() {
var frag = can.view.mustache('<my-component></my-component>')();
$('#test-area').html(frag);
});
afterEach(function() {
$('#test-area').empty();
});
it('initializes the component and clicks on button', function(done) {
F('my-component').exists();
F('my-component button').click();
F(done);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment