Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Jul 10, 2020

This is a fix for #175

@ghost ghost requested review from asisayag2, patrick-tolosa and strausr July 10, 2020 11:23
attributes.id = attributes.id + '-cld-placeholder';
}

// Set dataSrc if lazy loading and not in view
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this lazy load part related?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed to update this because i added withCamelCaseKeys().

Comment on lines 9 to 11
.should('have.attr', 'data-src').should('equal','http://res.cloudinary.com/demo/image/upload/c_scale,w_100/sample')
cy.get('#responsive-override')
.should('have.attr', 'src').should('equal','http://res.cloudinary.com/demo/image/upload/c_scale,w_100/sample')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really, it should have both?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, added comments to explain

cy.visit('/');
cy.get('#responsiveBtn').click(); // Click on button
});
it('Responsive Image Override', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain what you mean by "responsive override"?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments

*/
isResponsive = () => {
return this.props.responsive && this.imgElement && this.imgElement.current;
const {imgElement} = this;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const {imgElement} = this;
const {responsive, width} = this.getExtendedProps();
if (responsive && width !== 'auto') {
console.warn(WARNING_CONST);
}
return responsive && this.imgElement && this.imgElement.current;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, refactored as suggested

Comment on lines +72 to +74
if (attributes.dataSrc) {
attributes['data-src'] = attributes.dataSrc;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

???

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this again, calculating a new src isn't required, i've updated this part, please see updated commit

@ghost ghost merged commit 4352171 into master Jul 11, 2020
@ghost ghost deleted the fix/responsive-image branch July 16, 2020 11:33
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants