jsFiddle template to run a jasmine test inside jsFiddle.
Adds jasmine external resources, and initializes jasmine's HtmlReporter on window load. For more infor check this article: http://opensas.wordpress.com/2013/06/23/sharing-you-javascript-ninja-secrets-run-your-jasmine-tests-on-jsfiddle/
/*
This sample js snippet shows how to run a simple jasmine test inside jsFiddle.
To make your tests pass, just comment out the line 15, uncomment the line 16 and press ctrl-enter to run the test.
For more info check: http://opensas.wordpress.com/2013/06/23/sharing-you-javascript-ninja-secrets-run-your-jasmine-tests-on-jsfiddle/
*/
/*
Assignment: implement the calculator.sum method so that it takes two parameters and returns the sum of them.
*/
// source code
var calculator = {
sum: NOT_IMPLEMENTED
// sum: function(a, b) { return a + b; }
};
// specs code
describe("calculator", function() {
it("sum method should be implemented", function() {
expect(calculator.sum).toBeDefined();
});
it("sum method should sum values", function() {
expect(calculator.sum(1,2)).toEqual(3);
});
});
var NOT_IMPLEMENTED = undefined;
// load jasmine htmlReporter
(function() {
var env = jasmine.getEnv();
env.addReporter(new jasmine.HtmlReporter());
env.execute();
}());
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.