Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe("PageLoadHandler", function() {
- var whenPageLoads;
- beforeEach(function() {
- whenPageLoads = PageLoadHandler.create();
- });
- it("behaves as a singleton", function() {
- otherPageLoader = PageLoadHandler.create();
- expect(otherPageLoader).toBe(whenPageLoads);
- });
- describe('execute', function() {
- it("passes the function it is called with to jQuery's onLoad", function() {
- spyOn(window,'jQuery');
- var bla = function() {}
- whenPageLoads.execute(bla);
- expect(window.jQuery).toHaveBeenCalledWith(bla);
- });
- });
- describe("executed", function() {
- it("lets us know we executed a given method", function() {
- var yarp = function() {}
- whenPageLoads.execute(yarp);
- expect(whenPageLoads).toHaveExecuted(yarp);
- });
- it("lets us we did not execute a method", function() {
- var dorp = function() {}
- expect(whenPageLoads).not.toHaveExecuted(dorp)
- });
- });
- });
Add Comment
Please, Sign In to add comment