Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 978952 - stand up trivial mocha/chai unit test #4

Merged
merged 1 commit into from
Mar 4, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions browser/components/loop/test/mocha-test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
== Mocha unit tests ==

These unit tests use the browser build of the [Mocha test framework][1]
and the Chai Assertion Library's [BDD interface][2].

[1]: http://visionmedia.github.io/mocha/
[2]: http://chaijs.com/api/bdd/

Aim your browser at the index.html in this directory on your localhost using a file: or HTTP URL to run the tests.

Next steps:
* hook up to Marionette test suite so that they can be run by Tbpl
* run via mach command-line
* run using JS http server so the property security context for DOM elements is used

29 changes: 29 additions & 0 deletions browser/components/loop/test/mocha-test/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Loop mocha tests</title>
<link rel="stylesheet" media="all" href="../vendor/mocha-1.17.1.css">
</head>
<body>
<div id="mocha">
<p><a href=".">Index</a></p>
</div>
<div id="messages"></div>
<div id="fixtures"></div>
<!-- test dependencies -->
<script src="../vendor/mocha-1.17.1.js"></script>
<script src="../vendor/chai-1.9.0.js"></script>
<script src="../../content/libs/zepto.min.js"></script>
<script>
chai.Assertion.includeStack = true;
mocha.setup('bdd');
</script>
<script src="sample_test.js"></script>
<script>
mocha.run(function () {
$("#mocha").append("<p id='complete'>complete</p>");
});
</script>
</body>
</html>
9 changes: 9 additions & 0 deletions browser/components/loop/test/mocha-test/sample_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var expect = chai.expect;

describe("test", function() {
"use strict";

it("is true", function() {
expect(true).eql(true);
});
});
Loading