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,"click event");
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 ready event, but
> > events are not being wired up when I have a unit test on the page in a
> > sepearate ready event. 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 click event will 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
-~----------~----~----~----~------~----~------~--~---