Line | |
---|
1 | // Load the file to test here.
|
---|
2 | //
|
---|
3 | // Example:
|
---|
4 | EnvJasmine.load(EnvJasmine.jsDir + "ajaxDemo.js");
|
---|
5 |
|
---|
6 | // This is the test code.
|
---|
7 | describe("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.