开发者

How to test ajax with jsunit?

开发者 https://www.devze.com 2023-02-19 16:44 出处:网络
Did anybody write tests for ajax with jsunit? I don\'t now how to test asynchronous functions. Could you please show me some examples?开发者_如何学编程

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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消