Fully namespaced, debuggable unit tests
Colin Clark
colin.clark at utoronto.ca
Fri Feb 29 03:54:02 UTC 2008
Hi Anastasia,
I've committed my modifications to testrunner.js. This moves
everything within a namespaced closure and aliases the $ variable
safely to jQuery. You should now be able to use it without any trouble
in jQuery's noConflicts() mode. Let me know how it goes.
Colin
On 28-Feb-08, at 5:41 PM, Colin Clark wrote:
> I have an in-progress patch for testrunner.js that encloses all of its
> code in a closure, using the same technique as is typical for jQuery
> plugins. This approach aliases jQuery to $ in a safe way. Here's a
> simple example:
>
> var myNamespace = function ($) {
> $ ("foo"); // It's safe to use $ in this case because it has been
> defined within function scope, not globally.
> } (jQuery);
>
> testrunner.js comes from the jQuery source repository. Here's a link:
>
> http://jqueryjs.googlecode.com/svn/trunk/jquery/test/data/
> testrunner.js
>
> It's dual-licensed as MIT/GPL, so we're safe to use it and modify it.
> We should, however, share our changes back with the community. I'll do
> so as soon as I've finished the patch. In the meantime, go ahead with
> your temporary workaround.
---
Colin Clark
Technical Lead, Fluid Project
Adaptive Technology Resource Centre, University of Toronto
http://fluidproject.org