diff --git a/extensions/amp-izlesene/0.1/amp-izlesene.js b/extensions/amp-izlesene/0.1/amp-izlesene.js index a030ae93fc9a..d0da5ad6843e 100644 --- a/extensions/amp-izlesene/0.1/amp-izlesene.js +++ b/extensions/amp-izlesene/0.1/amp-izlesene.js @@ -107,6 +107,15 @@ class AmpIzlesene extends AMP.BaseElement { return this.loadPromise(iframe); } + /** @override */ + unlayoutCallback() { + if (this.iframe_) { + this.element.removeChild(this.iframe_); + this.iframe_ = null; + } + return true; + } + /** @override */ pauseCallback() { if (this.iframe_ && this.iframe_.contentWindow) { diff --git a/extensions/amp-izlesene/0.1/test/test-amp-izlesene.js b/extensions/amp-izlesene/0.1/test/test-amp-izlesene.js index 09bff5f7dba9..ecd78ef89913 100644 --- a/extensions/amp-izlesene/0.1/test/test-amp-izlesene.js +++ b/extensions/amp-izlesene/0.1/test/test-amp-izlesene.js @@ -74,5 +74,17 @@ describes.realWin( ); }); }); + + it('unlayout and relayout', async () => { + const izlesene = await getIzlesene('7221390'); + expect(izlesene.querySelector('iframe')).to.exist; + + const unlayoutResult = izlesene.unlayoutCallback(); + expect(unlayoutResult).to.be.true; + expect(izlesene.querySelector('iframe')).to.not.exist; + + await izlesene.layoutCallback(); + expect(izlesene.querySelector('iframe')).to.exist; + }); } );