javascript - jQuery tablesorter not initializing when tested with Jasmine -
i'm having issues testing jquery tablesorter table (with server-side sorting) jasmine. table never seems make ajax calls. in code below, fail @ expect(jasmine.ajax.requests.mostrecent().url).tocontain(reportslisturl);
. "reportslisturl" base of tablesorterpager.ajaxurl
.
it seems though tablesorter failing make sort of ajax calls during jasmine testing. table functions in practice no errors.
here jasmine test:
jasmine.getfixtures().fixturespath = "fixtures"; describe("admin manage reports", function() { beforeeach(function() { loadfixtures("admin_manage_reports_template.html"); jasmine.ajax.install(); }); aftereach(function() { jasmine.ajax.uninstall(); }); it("calls reportslisturl when pagerupdate triggered", function() { expect(adminwriteaccess).tobedefined(); expect(reportslisturl).tobedefined(); expect(deleteurl).tobedefined(); expect(usersurl).tobedefined(); expect(json).tobedefined(); expect(table).tobedefined(); expect(window.setupreportstable).tobedefined(); expect(window.updatereportstable).tobedefined(); expect(window.clearfilters).tobedefined(); // jasmine.ajax.stubrequest(/.*/).andreturn({ // "responsetext": "foo" // }); spyon(window, "updatereportstable"); window.updatereportstable(); expect(window.updatereportstable).tohavebeencalled(); expect(jasmine.ajax.requests.mostrecent().url).tocontain(reportslisturl); }); });
please forgive javascript if it's not best. i'm not js developer trade, , jasmine new me. ideas why tablesorter may failing make ajax requests? jasmine.ajax.requests.mostrecent()
undefined...
typeerror: jasmine.ajax.requests.mostrecent(...) undefined in file:///xxx/xxx/xxx/xxx/xxx/xxx/xxx/xxx/tests/ui/test-admin-manage-reports.js (line 30)
Comments
Post a Comment