2025-11-02 14:35:35 +03:00

27 lines
615 B
JavaScript

'use strict';
const jquery = require('jquery');
const mockjax = require('../../src/jquery.mockjax')(jquery, window);
mockjax({
url: '/resource',
responseText: 'content'
});
/* jshint unused:false */
function getResource(cb) {
jquery.ajax({
url: '/resource',
success: cb,
error: cb
});
}
/* jshint unused:true */
// These are just here so that my tests can hit the *same* jQuery instance
// that Mockjax is on as well as the `getResource()` function above.
// You would NOT need this in your own code.
window.jQuery = window.$ = jquery;
window.getResource = getResource;