From c6156994df8307e7d9bb4cba843ec458357e4ffa Mon Sep 17 00:00:00 2001 From: Dima Voytenko Date: Thu, 1 Apr 2021 10:08:46 -0700 Subject: [PATCH 1/2] Provide unlayoutCallback for amp-izlesene --- extensions/amp-izlesene/0.1/amp-izlesene.js | 9 +++++++++ .../amp-izlesene/0.1/test/test-amp-izlesene.js | 12 ++++++++++++ 2 files changed, 21 insertions(+) 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..4c4f81905c97 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 reloayout', 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; + }); } ); From 205dcfac7972ff13c829fc1cf7be2c9d3417e2fe Mon Sep 17 00:00:00 2001 From: Dima Voytenko Date: Thu, 1 Apr 2021 12:18:31 -0700 Subject: [PATCH 2/2] fix spelling --- extensions/amp-izlesene/0.1/test/test-amp-izlesene.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 4c4f81905c97..ecd78ef89913 100644 --- a/extensions/amp-izlesene/0.1/test/test-amp-izlesene.js +++ b/extensions/amp-izlesene/0.1/test/test-amp-izlesene.js @@ -75,7 +75,7 @@ describes.realWin( }); }); - it('unlayout and reloayout', async () => { + it('unlayout and relayout', async () => { const izlesene = await getIzlesene('7221390'); expect(izlesene.querySelector('iframe')).to.exist;