Skip to content

Commit

Permalink
Revert "Fix amp-image won't render after resize in amp-fx-flying-carp…
Browse files Browse the repository at this point in the history
…et with media attribute (#16809)"

This reverts commit a08806c.
  • Loading branch information
cathyxz authored Jul 17, 2018
1 parent 0d834fa commit 59ed64d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 101 deletions.
5 changes: 2 additions & 3 deletions extensions/amp-fx-flying-carpet/0.1/amp-fx-flying-carpet.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,11 @@ export class AmpFlyingCarpet extends AMP.BaseElement {
}

/** @override */
onMeasureChanged() {
onLayoutMeasure() {
const width = this.getLayoutWidth();
this.mutateElement(() => {
this.getVsync().mutate(() => {
setStyle(this.container_, 'width', width, 'px');
});
this.scheduleLayout(dev().assertElement(this.container_));
}

/** @override */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,16 @@ describes.realWin('amp-fx-flying-carpet', {
const container = flyingCarpet.firstChild.firstChild;
let width = 10;

impl.mutateElement = function(callback) {
impl.getVsync().mutate = function(callback) {
callback();
};
impl.getLayoutWidth = () => width;

impl.onMeasureChanged();
impl.onLayoutMeasure();
expect(container.style.width).to.equal(width + 'px');

width++;
impl.onMeasureChanged();
impl.onLayoutMeasure();
expect(container.style.width).to.equal(width + 'px');
});
});
Expand Down Expand Up @@ -206,20 +206,4 @@ describes.realWin('amp-fx-flying-carpet', {
expect(attemptCollapse).to.have.been.called;
});
});

it('should relayout the content on onMeasureChanged', () => {
return getAmpFlyingCarpet().then(flyingCarpet => {
const impl = flyingCarpet.implementation_;
const container = flyingCarpet.firstChild.firstChild;
const scheduleLayoutSpy_ = sandbox.spy(impl, 'scheduleLayout');

impl.mutateElement = function(callback) {
callback();
};

impl.onMeasureChanged();
expect(scheduleLayoutSpy_).to.have.been.calledWith(container);
});
});

});
79 changes: 0 additions & 79 deletions test/manual/amp-flying-carpet-media.amp.html

This file was deleted.

0 comments on commit 59ed64d

Please sign in to comment.