-
Couldn't load subscription status.
- Fork 215
Fix responsive prop, add a warning when it's not affecting the transformation #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| attributes.id = attributes.id + '-cld-placeholder'; | ||
| } | ||
|
|
||
| // Set dataSrc if lazy loading and not in view |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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().
| .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') |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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', () => { |
There was a problem hiding this comment.
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"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comments
src/components/Image/Image.js
Outdated
| */ | ||
| isResponsive = () => { | ||
| return this.props.responsive && this.imgElement && this.imgElement.current; | ||
| const {imgElement} = this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const {imgElement} = this; | |
| const {responsive, width} = this.getExtendedProps(); | |
| if (responsive && width !== 'auto') { | |
| console.warn(WARNING_CONST); | |
| } | |
| return responsive && this.imgElement && this.imgElement.current; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, refactored as suggested
| if (attributes.dataSrc) { | ||
| attributes['data-src'] = attributes.dataSrc; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
???
There was a problem hiding this comment.
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
This is a fix for #175