Guest User

Untitled

a guest
Jul 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. describe("PageLoadHandler", function() {
  2. var whenPageLoads;
  3. beforeEach(function() {
  4. whenPageLoads = PageLoadHandler.create();
  5. });
  6. it("behaves as a singleton", function() {
  7. otherPageLoader = PageLoadHandler.create();
  8. expect(otherPageLoader).toBe(whenPageLoads);
  9. });
  10. describe('execute', function() {
  11. it("passes the function it is called with to jQuery's onLoad", function() {
  12. spyOn(window,'jQuery');
  13. var bla = function() {}
  14. whenPageLoads.execute(bla);
  15. expect(window.jQuery).toHaveBeenCalledWith(bla);
  16. });
  17. });
  18.  
  19. describe("executed", function() {
  20. it("lets us know we executed a given method", function() {
  21. var yarp = function() {}
  22. whenPageLoads.execute(yarp);
  23. expect(whenPageLoads).toHaveExecuted(yarp);
  24. });
  25. it("lets us we did not execute a method", function() {
  26. var dorp = function() {}
  27. expect(whenPageLoads).not.toHaveExecuted(dorp)
  28. });
  29. });
  30. });
Add Comment
Please, Sign In to add comment