diff --git a/src/loaders/index.js b/src/loaders/index.js index daa1fc4..6c3242a 100644 --- a/src/loaders/index.js +++ b/src/loaders/index.js @@ -69,12 +69,12 @@ // Override the destroy function // making sure to destroy the current Loader AppPrototype._parentDestroy = AppPrototype.destroy; -AppPrototype.destroy = function destroy() +AppPrototype.destroy = function destroy(removeView) { if (this._loader) { this._loader.destroy(); this._loader = null; } - this._parentDestroy(); + this._parentDestroy(removeView); }; diff --git a/src/loaders/index.js b/src/loaders/index.js index daa1fc4..6c3242a 100644 --- a/src/loaders/index.js +++ b/src/loaders/index.js @@ -69,12 +69,12 @@ // Override the destroy function // making sure to destroy the current Loader AppPrototype._parentDestroy = AppPrototype.destroy; -AppPrototype.destroy = function destroy() +AppPrototype.destroy = function destroy(removeView) { if (this._loader) { this._loader.destroy(); this._loader = null; } - this._parentDestroy(); + this._parentDestroy(removeView); }; diff --git a/test/core/Application.js b/test/core/Application.js index aa726b0..00eb286 100644 --- a/test/core/Application.js +++ b/test/core/Application.js @@ -17,4 +17,21 @@ done(); }); }); + + it('should remove canvas when destroyed', function (done) + { + const app = new PIXI.Application(); + const view = app.view; + + expect(view).to.be.instanceof(HTMLCanvasElement); + document.body.appendChild(view); + + app.ticker.addOnce(() => + { + expect(document.body.contains(view)).to.be.true; + app.destroy(true); + expect(document.body.contains(view)).to.be.false; + done(); + }); + }); });