-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
(cherry picked from commit fbdec7e) Co-authored-by: Ty Hopp <[email protected]>
- Loading branch information
Showing
51 changed files
with
487 additions
and
940 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
File renamed without changes
2 changes: 1 addition & 1 deletion
2
...-image/cypress/integration/constrained.js → ...s/integration/static-image/constrained.js
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
4 changes: 2 additions & 2 deletions
4
...ic-image/cypress/integration/fullWidth.js → ...ss/integration/static-image/full-width.js
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
9 changes: 9 additions & 0 deletions
9
e2e-tests/development-runtime/cypress/integration/static-image/immediately-unmounted.js
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,9 @@ | ||
describe(`immediately unmounted`, () => { | ||
beforeEach(() => { | ||
cy.visit(`/static-image/immediately-unmounted`) | ||
}) | ||
|
||
it(`should not error`, () => { | ||
cy.assertNoFastRefreshOverlay() | ||
}) | ||
}) |
2 changes: 1 addition & 1 deletion
2
...press/integration/intesection-observer.js → ...tion/static-image/intesection-observer.js
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
33 changes: 33 additions & 0 deletions
33
e2e-tests/development-runtime/cypress/integration/static-image/native-lazy-loading.js
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,33 @@ | ||
describe(`gatsby-plugin-image / native lazy loading`, () => { | ||
beforeEach(() => { | ||
cy.visit(`/static-image/lazy-loading`) | ||
}) | ||
|
||
it(`lazy loads an image when scrolling`, () => { | ||
// We need to wait for a decent amount of time so that the image | ||
// can resolve. This is necessary because the assertion | ||
// is done outside the Cypress scheduler and so, Cypress is not able | ||
// to ping for the specific assertion to be truthy. | ||
cy.wait(500) | ||
cy.get(`[data-cy=already-loaded]`) | ||
.should(`be.visible`) | ||
.then($img => { | ||
expect($img[0].complete).to.equal(true) | ||
}) | ||
|
||
cy.get(`[data-cy=lazy-loaded]`) | ||
.should(`exist`) | ||
.then($img => { | ||
expect($img[0].complete).to.equal(false) | ||
}) | ||
|
||
cy.scrollTo(`bottom`) | ||
|
||
cy.wait(500) | ||
cy.get(`[data-cy=lazy-loaded]`) | ||
.should(`exist`) | ||
.then($img => { | ||
expect($img[0].complete).to.equal(true) | ||
}) | ||
}) | ||
}) |
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
File renamed without changes
File renamed without changes
9 changes: 4 additions & 5 deletions
9
...sby-static-image/src/pages/constrained.js → ...ime/src/pages/static-image/constrained.js
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
9 changes: 4 additions & 5 deletions
9
...ts/gatsby-static-image/src/pages/fixed.js → ...t-runtime/src/pages/static-image/fixed.js
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
9 changes: 4 additions & 5 deletions
9
...atsby-static-image/src/pages/fullWidth.js → ...time/src/pages/static-image/full-width.js
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
22 changes: 22 additions & 0 deletions
22
e2e-tests/development-runtime/src/pages/static-image/immediately-unmounted.js
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,22 @@ | ||
import React, { useState, useEffect } from "react" | ||
import { StaticImage } from "gatsby-plugin-image" | ||
|
||
const ImmediatelyUnmounted = () => { | ||
const [show, setShow] = useState(true) | ||
|
||
useEffect(() => { | ||
setTimeout(() => { | ||
setShow(false) | ||
}, 1) | ||
}, []) | ||
|
||
return ( | ||
<> | ||
{show && ( | ||
<StaticImage src="../../images/citrus-fruits.jpg" alt="Citrus fruits" /> | ||
)} | ||
</> | ||
) | ||
} | ||
|
||
export default ImmediatelyUnmounted |
3 changes: 1 addition & 2 deletions
3
...ts/gatsby-static-image/src/pages/index.js → ...t-runtime/src/pages/static-image/index.js
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
9 changes: 4 additions & 5 deletions
9
...s/gatsby-static-image/src/pages/traced.js → ...-runtime/src/pages/static-image/traced.js
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.