-
-
Save mxriverlynn/3826799 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); | |
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