views:

94

answers:

2

Hi all:

I'm currently trying to mock the following method using Jack. The code example is as below:

var ID = "id";
$('#' + ID + ' > div > table').each(function) {
    var nodeSpan = $(this).find('span.' + NODE_INDICATORS)[0];
.
.
.
});

How should I approach it? Are there jQuery/QUnit functions that allows me to create a DOM node/element which I can use to mock the find method? Or can this be done easily with Jack?

Thanks.

+1  A: 

If all you want to do is make nodes as part of your test, you can just use the HTML "signature" of the jQuery method; for instance:

$(someNode).append("<DIV id='55'>I'm a DIV!</DIV>");

If that's not what you're trying to do, maybe try to explain your question better?

machineghost
A: 

I ended up supplying a DOM structure to pass the jquery code instead of mocking it.

BeraCim