openseadragon/test/dzi-jsonp.js
2013-05-10 11:53:49 -07:00

51 lines
1.4 KiB
JavaScript

(function() {
module('DZI JSONp');
var viewer = null;
// ----------
asyncTest('Open', function() {
$(document).ready(function() {
var timeWatcher = Util.timeWatcher();
viewer = OpenSeadragon({
id: 'example',
prefixUrl: '/build/openseadragon/images/',
tileSources: '/test/data/testpattern.js'
});
ok(viewer, 'Viewer exists');
var openHandler = function(eventSender, eventData) {
viewer.removeHandler('open', openHandler);
ok(true, 'Open event was sent');
viewer.drawer.viewer = viewer;
viewer.addHandler('tile-drawn', tileDrawnHandler);
};
var tileDrawnHandler = function(eventSender, eventData) {
viewer.removeHandler('tile-drawn', tileDrawnHandler);
ok(true, 'A tile has been drawn');
timeWatcher.done();
};
viewer.addHandler('open', openHandler);
});
});
// ----------
asyncTest('Close', function() {
var closeHandler = function() {
viewer.removeHandler('close', closeHandler);
$('#example').empty();
ok(true, 'Close event was sent');
start();
};
viewer.addHandler('close', closeHandler);
viewer.close();
});
})();