Skip to content

Instantly share code, notes, and snippets.

@apaatsio
Created April 18, 2012 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apaatsio/2412073 to your computer and use it in GitHub Desktop.
Save apaatsio/2412073 to your computer and use it in GitHub Desktop.
how to unit test internal functions in jquery plugin?
// Define global Test object. You can leave this out in production.
Test = Test || {};
(function($) {
var someHelperFunction = function(s, d) {
return s*d;
}
var someOtherHelperFunction = function(s) {
return s*2;
}
// here goes the normal plugin code
if(typeof Test !== 'undefined') {
Test.myPlugin.someHelperFunction = someHelperFunction;
Test.myPlugin.someOtherHelperFunction = someOtherHelperFunction;
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment