Hi Jörn,
Where should I put the HTML code I'm testing against if I don't use
#main? I thought the point of using #main was that it would get reset
after each test.

If I bind the click method on the setup method in module, isn't that
duplicating the code that I wrote to bind the click to the html tag in
my main JS file?

Thanks,

Nacho

On Oct 19, 1:23 pm, "Jörn Zaefferer" <[EMAIL PROTECTED]>
wrote:
> You should refactor your code, or avoid using the id "main". You could
> use the module method:
>
> module("...", {
>   before: function() {
>     $('#l2').click(test1);
>   }
>
> });
>
> Jörn
>
> On Sun, Oct 19, 2008 at 4:16 AM, John Teague <[EMAIL PROTECTED]> wrote:
> > yes, commenting out that line did resolve the issue.
>
> > Thanks you.  Please let me know if the change is going to committed to the
> > trunk or if I need to submit a bug report.
>
> > Thanks,
> > John
>
> > On Sat, Oct 18, 2008 at 4:59 PM, Diego Perini <[EMAIL PROTECTED]>
> > wrote:
>
> >> John,
> >> it doesn't seem a "ready()" problem, look instead in
> >> "testrunner.js"...explicitly in the "reset()" method that the "test()"
> >> function is calling inside a try/catch block.
>
> >> The content of the "#main" container is overwritten by the following
> >> line of code in the "reset()" method:
>
> >>   jQuery("#main").html( _config.fixture );
>
> >> Even if the "_config.fixture" is an exact clone of the original html,
> >> events are lost when using the ".html()" method to replace content.
>
> >> I have tested commenting the above line and theeventis correctly
> >> fired, the alert says "hello"...
>
> >> Hope I did understand and explain correctly,
>
> >> --
> >> Diego Perini
>
> >> On 18 Ott, 15:46, "John Teague" <[EMAIL PROTECTED]> wrote:
> >> > sure, here is the complete test suite.
>
> >> > thanks for helping with this,
> >> > John
>
> >> > <head><link rel="Stylesheet" href="../Content/css/testsuite.css"
> >> > /><title>
>
> >> > </title></head>
> >> > <body>
>
> >> >  <h1>WebService Tests</h1>
> >> >  <h2 id="banner"></h2>
> >> >  <h2 id="userAgent"></h2>
>
> >> >  <ol id="tests"></ol>
>
> >> >  <div id="main">
> >> >     <a id="l2" href="#">Execute Function Test</a>
> >> >  </div>
>
> >> > </body>
> >> > <script src="/Content/js/jquery.js" type="text/javascript"></script>
> >> > <script type="text/javascript">/*<![CDATA[*/
> >> >     $(document).ready(function(){
> >> >         $('#l2').click(test1);
>
> >> > });
>
> >> > //]]></script>
>
> >> > <script type="text/javascript"
> >> > src="../../Content/js/testrunner.js"></script>
> >> > <script type="text/javascript">
> >> >         function test1(){
> >> >             ok(true,"clickevent");
> >> >             alert("hello");
> >> >             return false;
> >> >         }
> >> >         $(document).ready(function(){
>
> >> >             module("when anchor is generated ");
> >> >             test("should create anchor with correct id",function(){
> >> >                 var $a = $('#l2');
> >> >                 ok($a.length === 1);
> >> >             });
>
> >> >             test("should create anchor with correct text",function(){
> >> >                 var $a = $('#l2');
> >> >                 ok($a.text() === 'Execute Function Test');
> >> >             });
>
> >> >             module("when calling execute function on click")
>
> >> >             test("should execute the specified method",function(){
> >> >                 expect(1);
> >> >                 var $a = $('#l2').click();
>
> >> >             });
>
> >> >         });
>
> >> >     </script>
> >> > </html>
>
> >> > On Sat, Oct 18, 2008 at 2:39 AM, Jörn Zaefferer <
>
> >> > [EMAIL PROTECTED]> wrote:
> >> > > Could you provide a more complete example?
>
> >> > > Jörn
>
> >> > > On Fri, Oct 17, 2008 at 6:41 PM, john teague <[EMAIL PROTECTED]>
> >> > > wrote:
>
> >> > > > I have a library that generates jquery that I would like to test
> >> > > > with
> >> > > >qUnit, but I'm running into problems.
>
> >> > > > The library generates attaches events during the readyevent, but
> >> > > > events are not being wired up when I have a unit test on the page in
> >> > > > a
> >> > > > sepearate readyevent.  My code looks like this.
> >> > > > <body>
> >> > > >  <div id="main">
> >> > > >        <a id="l2" href="#">Execute Function Test</a>
> >> > > >  </div>
> >> > > > </body>
> >> > > > --script source tags here
> >> > > > --this is the generated code
> >> > > > <script type="text/javascript">/*<![CDATA[*/
> >> > > >        $(document).ready(function(){
> >> > > >                $('#l2').click(function(){alert('hello')});
>
> >> > > > });
>
> >> > > > //]]></script>
> >> > > > -- and now the tests
> >> > > > <script type="text/javascript">
> >> > > > $(document).ready(function(){
> >> > > >                        module("when anchor is generated ");
> >> > > >                        test("should create anchor with correct
> >> > > id",function(){
> >> > > >                                var $a = $('#l2');
> >> > > >                                ok($a.length === 1);
> >> > > >                        });
> >> > > > });
> >> > > > </script>
> >> > > > the clickeventwill not fire for the anchor.
>
> >> > > > Any suggestions?
>
> >> > > > Thanks,
> >> > > > John

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

Reply via email to