source: pyenvjasmine/pyenvjasmine/envjasmine/specs/ajaxDemo.spec.js@ 0:0175515fceea

Last change on this file since 0:0175515fceea was 0:0175515fceea, checked in by Borja Lopez <borja@…>, 9 years ago

Imported sources from http://repos.betabug.ch/pyenvjasmine

File size: 546 bytes
Line 
1// Load the file to test here.
2//
3// Example:
4EnvJasmine.load(EnvJasmine.jsDir + "ajaxDemo.js");
5
6// This is the test code.
7describe("AjaxDemo", function () {
8 it("calls the addDataToDOM function on success", function () {
9 TwitterWidget.makeRequest(); // Make the AJAX call
10
11 spyOn(TwitterWidget, "addDataToDOM"); // Add a spy to the callback
12
13 mostRecentAjaxRequest().response({status: 200, responseText: "foo"}); // Mock the response
14
15 expect(TwitterWidget.addDataToDOM).toHaveBeenCalledWith("foo");
16 });
17});
Note: See TracBrowser for help on using the repository browser.