*You could temporarily expose your privates ;)*

I LOL'd at that line.

On Tue, Sep 8, 2009 at 1:15 PM, Mark Gibson <jollyt...@gmail.com> wrote:

>
> You could temporarily expose your privates ;)
>
> (function($) {
>
> function doStuff() { ... };
>
> /*
> window.FORTESTINGONLY = {
>  doStuff: doStuff
> };
> */
>
> })(jQuery);
>
> then when you want to test, uncomment the code, and access it with:
> window.FORTESTINGONLY.doStuff()
>
> - Mark
>
> 2009/9/8 fitzgen <fitz...@gmail.com>:
> >
> > Hello all,
> >
> > My understanding is that, when writing plugins for jQuery, there are a
> > couple best practices to follow. That the plugin limit itself to a
> > single namespace, and also that as much remain private, via closures,
> > in the plugin as possible, so as to expose a clean API. This all makes
> > perfect sense to me; keep things clean.
> >
> > I have written some tests that cover pretty much all of the exposed
> > API for my plugin, and after a pretty big refactor, I have broken a
> > couple things. Now, since the tests cover the higher level, abstracted
> > API only, and not the private methods, I only have a very general idea
> > where the code is failing.
> >
> > I was just wondering, what do you guys do in situations like this? I
> > know there is probably no magic bullet, but I am curious what
> > techniques other developers use to test the functionality of their
> > code that isn't publicly exposed.
> >
> > So far, the best I have come up with is copy pasting each private
> > function to the firebug console. This is beyond tedious, and slow, and
> > I know there has to be a better way. Plus, it isn't automated, like
> > the rest of my tests.
> >
> > Any suggestions?
> >
> > Thanks a lot.
> >
> > _Nick_
> >
> > >
> >
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to