Hi! I am trying to get started with QUnit - as a beginning project
I'm trying to set up unit test for use with the following function. I
am having trouble figuring out where to get started - any help would
be very valuable, thanks!
-Sarah
<code>
/* Copyright (c) 2008 Kean Loong Tan
http://www.gimiti.com/kltan * Licensed under the MIT (
http://www.opensource.org/licenses/mit-license.php)
* Name: jContext
* Version: 1.0 (April 28, 2008)
* Requires: jQuery 1.2+
*/
(function($) {
$.fn.showMenu = function(options) {
var opts = $.extend({}, $.fn.showMenu.defaults, options);
$(this).bind("contextmenu",function(e){
console.log("e is" + e)
opts.before(e);
$(opts.query).show().css({
top:e.pageY+"px",
left:e.pageX+"px",
position:"absolute",
opacity: opts.opacity,
zIndex: opts.zindex
});
return false;
});
$(document).bind("click",function(e){
$(opts.query).hide();
});
};
$.fn.showMenu.defaults = {
zindex: 2000,
query: document,
opacity: 1.0,
before: function(e){}
};
})(jQuery);
</code>