mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-02-21 09:13:14 +03:00
fix: comment updates and add a simple test for viewer.destroy
This commit is contained in:
parent
68f9d675fc
commit
0c662b8a8d
@ -91,7 +91,8 @@ $.EventHandler.prototype = {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all event handler for a given event type. If no type is given all event handlers for every event type is removed
|
* Remove all event handlers for a given event type. If no type is given all
|
||||||
|
* event handlers for every event type is removed.
|
||||||
* @function
|
* @function
|
||||||
* @param {String} eventName - Name of event for which all handlers are to be removed.
|
* @param {String} eventName - Name of event for which all handlers are to be removed.
|
||||||
*/
|
*/
|
||||||
|
@ -172,7 +172,7 @@
|
|||||||
$.MouseTracker.prototype = {
|
$.MouseTracker.prototype = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up any events or objects created the mouse tracker
|
* Clean up any events or objects created by the mouse tracker.
|
||||||
* @function
|
* @function
|
||||||
*/
|
*/
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
|
@ -513,7 +513,8 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to destroy the viewer and clean up everything created by Open Seadragon
|
* Function to destroy the viewer and clean up everything created by
|
||||||
|
* OpenSeadragon.
|
||||||
* @function
|
* @function
|
||||||
* @name OpenSeadragon.Viewer.prototype.destroy
|
* @name OpenSeadragon.Viewer.prototype.destroy
|
||||||
*/
|
*/
|
||||||
|
@ -208,4 +208,29 @@
|
|||||||
viewer.open('/test/data/testpattern.dzi');
|
viewer.open('/test/data/testpattern.dzi');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ----------
|
||||||
|
asyncTest('Destroy', function() {
|
||||||
|
viewer.addHandler("open", function () {
|
||||||
|
start();
|
||||||
|
// Check that the DOM has been modified
|
||||||
|
notEqual(0, $('#example').children().length);
|
||||||
|
|
||||||
|
var closeHandler = function() {
|
||||||
|
viewer.removeHandler('close', closeHandler);
|
||||||
|
ok(true, 'Close event was sent on Destroy');
|
||||||
|
};
|
||||||
|
|
||||||
|
viewer.addHandler('close', closeHandler);
|
||||||
|
viewer.destroy();
|
||||||
|
|
||||||
|
// Check that the DOM has been cleaned up
|
||||||
|
equal(0, $('#example').children().length);
|
||||||
|
equal(null, viewer.canvas);
|
||||||
|
equal(null, viewer.keyboardCommandArea);
|
||||||
|
equal(null, viewer.container);
|
||||||
|
equal(null, viewer.element);
|
||||||
|
});
|
||||||
|
viewer.open('/test/data/testpattern.dzi');
|
||||||
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user