Created
October 31, 2012 22:11
-
-
Save ScottMaclure/3990295 to your computer and use it in GitHub Desktop.
Jasmine Bootstrap
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
/** | |
* Basic skeleton for a Jasmine spec file, to test a jQuery plugin. | |
*/ | |
describe("myPlugin specs", function () { | |
var $container; | |
/** | |
* Mock mininum amount of html required for plugin to operate. | |
*/ | |
function createHtml() { | |
var out = []; | |
// Build up the most minimal amount of HTML required for your plugin to operate. | |
out.push('<div class="fn-myPlugin"></div>'); | |
return out.join(""); | |
} | |
/** | |
* Setup for testing: bind plugin being tested to html inside the container. | |
* Do other stuff like Sinon FakeServer, spies, etc. | |
*/ | |
beforeEach(function () { | |
$container = $("<div></div>").append(createHtml()).appendTo("body"); | |
}); | |
/** | |
* | |
*/ | |
afterEach(function() { | |
$container.remove(); | |
}); | |
it("will do something", function () { | |
expect("todo").toBe("done"); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment