JSFiddle - React, Tailwind, and code Playground
by blesh
HTML
<div></div>
JavaScript
function MyModule(global, $) {
global.test = 'foo';
$.fn.writeTest = function() {
$(this).text(global.test);
};
}
//mock up our dependencies
var windowMock = {};
var jQueryMock = {
fn: {}
};
//default usage
MyModule(windowMock, jQueryMock);
//Some tests
alert('window has test property: ' + (windowMock.test !== undefined));
alert('jQuery has writeTest: ' + (jQueryMock.fn.writeTest !== undefined));