Skip to content

Instantly share code, notes, and snippets.

@mxriverlynn
Forked from anonymous/Calculator.js
Created October 3, 2012 13:06
Show Gist options
  • Save mxriverlynn/3826799 to your computer and use it in GitHub Desktop.
Save mxriverlynn/3826799 to your computer and use it in GitHub Desktop.
Jasmine.Async example
var Calculator = function(displayElement) {
this.$el = $(displayElement);
};
Calculator.prototype.hideResult = function(cb) {
this.$el.fadeOut(1000, cb);
};
describe("Calculator", function() {
var calc, el;
var async = new AsyncSpec(this);
async.beforeEach(function(done) {
el = $("<div>some content</div>");
$("#container").append(el);
calc = new Calculator(el);
var callback = function() {
done();
};
calc.hideResult(callback);
});
afterEach(function() {
el.remove();
});
it("should make the result invisible", function() {
expect(el.css("display")).toBe("none");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment