-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix lazy loading of responsive images (#182)
- Loading branch information
Nir Maoz
authored
Jul 26, 2020
1 parent
d4b83c4
commit c5b4bbd
Showing
3 changed files
with
46 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
describe('Lazy Responsive Image', () => { | ||
beforeEach(() => { | ||
// runs before each test in the block | ||
cy.visit('/'); | ||
cy.get('#lazyResponsiveBtn').click(); // Click on button | ||
}); | ||
it('Should not have src attribute when not in view', () => { | ||
cy.get('#lazyResponsive') | ||
.should('not.be.visible') | ||
.should('not.have.attr', 'src'); | ||
}); | ||
it('Should have src attribute when view', () => { | ||
cy.scrollTo(0, 3000); | ||
cy.get('#lazyResponsive') | ||
.should('be.visible') | ||
.should('have.attr', 'src').should('equal', 'http://res.cloudinary.com/demo/image/upload/c_scale,w_400/sample'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters