testing ready events with qunit

testing ready events with qunit


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