Created
October 3, 2012 04:32
-
-
Save anonymous/3825008 to your computer and use it in GitHub Desktop.
Jasmine.Async example
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
var Calculator = function(displayElement) { | |
this.$el = $(displayElement); | |
}; | |
Calculator.prototype.hideResult = function(cb) { | |
this.$el.fadeOut(1000, cb); | |
}; | |
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
describe("Calculator", function() { | |
var calc, el; | |
var async = new AsyncSpec(this); | |
beforeEach(function() { | |
el = $("<div>some content</div>"); | |
$("#container").append(el); | |
calc = new Calculator(el); | |
}); | |
afterEach(function() { | |
el.remove(); | |
}); | |
async.it("should make the result invisible", function(done) { | |
var callback = function() { | |
expect(el.css("display")).toBe("none"); | |
done(); | |
}; | |
calc.hideResult(callback); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment