3

Did anybody write tests for ajax with jsunit? I don't now how to test asynchronous functions.

Could you please show me some examples?

Example.

I have function
var General = function() { }
General.prototype = {
limit: null,

loadData: function() {
        var url = "General.GetSessionData"
        var self = this;

        $.ajax({
            url: url,
            data: {},
            datatype: 'json',                
            success: function(data) {
                self.limit = data;
        });
    },
}

How i can test this?

isxaker
  • 6,265
  • 6
  • 48
  • 77

1 Answers1

1

Have you tried googling? HERE is an example test (asynchronous). The parent URL tells you how everything about JSUnit tests.

rsplak
  • 11,428
  • 2
  • 31
  • 30