I have a similar need I have a working test like below, the widget loads an image and the test has to wait until the image is loaded, I have several tests that require the image to be loaded, will your patch allow me to put the code in a setup/teardown function?
A currently working test:
el2 = $("<div id='iv2' class='viewer'></div>").css({ "width": "100px", "height": "100px" });
$("body").append(el2);
el2.imageviewer({
image_to_load: "../../testimages/300x300_pink.jpg",
imageloaded: function () { console.log("image loaded");
}
});
stop();
setTimeout(function () {
ok($(el2).find("img").length, "image tag is added");
equals($(el2).find("img").width(), 100, "image should be resized to the width of the container");
start();
}, 5000);
});