Skip to content

Commit

Permalink
amp-instagram: allow changeHeight unconditionally (#11788)
Browse files Browse the repository at this point in the history
  • Loading branch information
aghassemi committed Jan 25, 2018
1 parent 0819d2e commit 2270d9e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions extensions/amp-instagram/0.1/amp-instagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ class AmpInstagram extends AMP.BaseElement {
if (this.iframe_ && this.iframe_./*OK*/offsetHeight !== height) {
// Height returned by Instagram includes header, so
// subtract 48px top padding
this.attemptChangeHeight(height - (PADDING_TOP + PADDING_BOTTOM))
.catch(() => {});
this./*OK*/changeHeight(height - (PADDING_TOP + PADDING_BOTTOM));
}
});
}
Expand Down
6 changes: 3 additions & 3 deletions extensions/amp-instagram/0.1/test/test-amp-instagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ describes.realWin('amp-instagram', {
return getIns('fBwFP', true).then(ins => {
const impl = ins.implementation_;
const iframe = ins.querySelector('iframe');
const attemptChangeHeight = sandbox.spy(impl, 'attemptChangeHeight');
const changeHeight = sandbox.spy(impl, 'changeHeight');
const newHeight = 977;

expect(iframe).to.not.be.null;
Expand All @@ -170,9 +170,9 @@ describes.realWin('amp-instagram', {
height: newHeight,
});

expect(attemptChangeHeight).to.be.calledOnce;
expect(changeHeight).to.be.calledOnce;
// Height minus padding
expect(attemptChangeHeight.firstCall.args[0]).to.equal(newHeight - 64);
expect(changeHeight.firstCall.args[0]).to.equal(newHeight - 64);
});
});

Expand Down

0 comments on commit 2270d9e

Please sign in to comment.