Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gatsbyjs/gatsby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: gatsby@2.24.77
Choose a base ref
...
head repository: gatsbyjs/gatsby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: gatsby@2.24.78
Choose a head ref
  • 15 commits
  • 123 files changed
  • 14 contributors

Commits on Oct 14, 2020

  1. feat(gatsby-source-contentful): add tool to force-cache remote data t…

    …o debug (#27404)
    
    * feat(gatsby-source-contentful): add debugging tool to force-cache remote data locally
    
    * -> GATSBY_CONTENTFUL_EXPERIMENTAL_FORCE_CACHE
    pvdz authored Oct 14, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2964b62 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a3e72b9 View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d8acab3 View commit details
  4. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    27ae3aa View commit details
  5. feat(gatsby-plugin-typescript): Add schema (#27361)

    * Add schema for gatsby-plugin-typescript
    
    * Update packages/gatsby-plugin-typescript/src/gatsby-node.js
    
    Co-authored-by: Matt Kane <matt@gatsbyjs.com>
    
    * eronuous curly braces
    
    * listen to experimental flag
    
    * update load plugins snapshot
    
    * update plugin test exepected result
    
    * add unit tests for schema
    
    Co-authored-by: Matt Kane <matt@gatsbyjs.com>
    Co-authored-by: gatsbybot <mathews.kyle+gatsbybot@gmail.com>
    3 people authored Oct 14, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    072ef6c View commit details
  6. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d6f033e View commit details
  7. chore(gatsby-source-contentful): move to pluginOptionsSchema (#27322)

    * Move gatsby-source-contentful to pluginOptionsSchema
    
    * Remove old validation options tests
    
    * Better error message in case of failed external Contentful validation
    
    * Restore old validation, wrap new one in env var
    
    * use preinit and overwrite defaults
    
    * remove console.log
    
    * fix fetch
    
    Co-authored-by: Abhi Aiyer <abhiaiyer91@gmail.com>
    Co-authored-by: Ward Peeters <ward@coding-tech.com>
    3 people authored Oct 14, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ae9f9a9 View commit details

Commits on Oct 15, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0e45a26 View commit details
  2. chore(deps): update dependency @typescript-eslint/eslint-plugin to ^2…

    ….34.0 (#27080)
    
    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Oct 15, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3aff70f View commit details
  3. chore(deps): update minor and patch for gatsby-cli (#27180)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Oct 15, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2f6aece View commit details
  4. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0db2074 View commit details
  5. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    9d304ed View commit details
  6. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e6162dd View commit details
  7. New Gatsby image plugin (#26924)

    * Add static image plugin
    
    * Parse static image files
    
    * Fix package.json
    
    * Better static analysis
    
    * Use jsx utils package
    
    * Fix typings
    
    * Typecheck fix
    
    * Fix repo fields
    
    * Helpful warning
    
    * Re-enable duotone
    
    * Update readme
    
    * Improve typings
    
    * wip fixed image fields for tracedSVG and webP
    
    * handle fluid images as well
    
    * Use require rather than JSON import
    
    * Watch files for changes, and use relative paths
    
    * Improve types
    
    * Add type
    
    * Update yarn.lock
    
    * Add lots of comments and remove unused stuff
    
    * Create and watch our own nodes
    
    * Update readme
    
    * Update deps
    
    * Only watch in develop
    
    * Rename to gatsby-plugin-image
    
    * Rearrange, ready for merger
    
    * Import @wardpeet 's gatsby-image-netxtgen
    
    * Update typings and further merge packages
    
    * Build babel plugin
    
    * More merging
    
    * Add server/browser static image variants
    
    * include webpack changes
    
    * change error message to use gatsby-plugin-image
    
    * Fix compat compilation
    
    * Fix SSR
    
    * Merge readmes
    
    * Build browser bundle
    
    * Export correctly from browser entry point
    
    * Remove hook import
    
    * Apply suggestions from code review
    
    Co-authored-by: LB <laurie@gatsbyjs.com>
    
    * Changes from review
    
    * add path prefix, static image do e2e test
    
    * Add prepare script
    
    * Apply README suggestions from code review
    
    Co-authored-by: LB <laurie@gatsbyjs.com>
    
    * Fix image component in e2e test
    
    * Better error messages
    
    * Prefer svg over base64. Warn for unsupported art direction
    
    * Fix type
    
    * Use "layout" instead of fixed/fluid
    
    * add static images to production runtime site
    
    * add path prefix tests
    
    * Reorg types. Change private prop name
    
    * initial gatsby static image tests
    
    * add test suite to circle ci
    
    * add test suite to circle ci
    
    * add test suite to circle ci
    
    * remove unused imports, use valid fluid setting
    
    * Use new fluid props syntax
    
    * Better var name
    
    * update tests
    
    * remove tests that no longer match the expected DOM
    
    * More compat-fixes
    
    * Change classname to match old version
    
    * Compat improvements
    
    * Update tests to match new classname
    
    * v0.0.1
    
    * Add readme caveat
    
    * Update version in packages
    
    * Remove forcewrapper
    
    * Changes from review
    
    * Apply suggestions from code review
    
    Co-authored-by: Ward Peeters <ward@coding-tech.com>
    
    * fix windows require
    
    * fix intrinsic & responsive layout
    
    * update e2e-test
    
    * move babel-plugin-remove-graphql-queries to dep
    
    Co-authored-by: Kyle Gill <kylerobertgill@gmail.com>
    Co-authored-by: Laurie <laurie@gatsbyjs.com>
    Co-authored-by: gatsbybot <mathews.kyle+gatsbybot@gmail.com>
    Co-authored-by: Ward Peeters <ward@coding-tech.com>
    5 people authored Oct 15, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    840f00d View commit details
  8. chore(release): Publish

     - gatsby-admin@0.1.166
     - gatsby-cli@2.12.108
     - gatsby-plugin-emotion@4.3.14
     - gatsby-plugin-image@0.0.2
     - gatsby-plugin-netlify@2.3.19
     - gatsby-plugin-offline@3.2.32
     - gatsby-plugin-sitemap@2.4.17
     - gatsby-plugin-typescript@2.4.22
     - gatsby-plugin-utils@0.2.32
     - gatsby-remark-images@3.3.34
     - gatsby-source-contentful@2.3.53
     - gatsby-transformer-remark@2.8.40
     - gatsby@2.24.78
    ascorbic committed Oct 15, 2020
    Copy the full SHA
    2494ae1 View commit details
Showing with 4,701 additions and 373 deletions.
  1. +9 −0 .circleci/config.yml
  2. +1 −2 .eslintignore
  3. +1 −1 .prettierignore
  4. +1 −0 e2e-tests/development-runtime/gatsby-config.js
  5. +1 −0 e2e-tests/development-runtime/package.json
  6. +7 −1 e2e-tests/development-runtime/src/components/image.js
  7. +11 −0 e2e-tests/gatsby-static-image/.gitignore
  8. +22 −0 e2e-tests/gatsby-static-image/LICENSE
  9. +30 −0 e2e-tests/gatsby-static-image/README.md
  10. BIN e2e-tests/gatsby-static-image/content/relative.jpg
  11. +3 −0 e2e-tests/gatsby-static-image/cypress.json
  12. +5 −0 e2e-tests/gatsby-static-image/cypress/fixtures/example.json
  13. +72 −0 e2e-tests/gatsby-static-image/cypress/integration/fixed.js
  14. +26 −0 e2e-tests/gatsby-static-image/cypress/integration/fluid.js
  15. +42 −0 e2e-tests/gatsby-static-image/cypress/integration/image.js
  16. +28 −0 e2e-tests/gatsby-static-image/cypress/integration/traced.js
  17. +17 −0 e2e-tests/gatsby-static-image/cypress/plugins/index.js
  18. +16 −0 e2e-tests/gatsby-static-image/cypress/support/index.js
  19. +11 −0 e2e-tests/gatsby-static-image/gatsby-config.js
  20. +39 −0 e2e-tests/gatsby-static-image/package.json
  21. +38 −0 e2e-tests/gatsby-static-image/src/components/header.js
  22. +624 −0 e2e-tests/gatsby-static-image/src/components/layout.css
  23. +36 −0 e2e-tests/gatsby-static-image/src/components/layout.js
  24. BIN e2e-tests/gatsby-static-image/src/images/citrus-fruits.jpg
  25. BIN e2e-tests/gatsby-static-image/src/images/gatsby-icon.png
  26. +11 −0 e2e-tests/gatsby-static-image/src/pages/404.js
  27. +32 −0 e2e-tests/gatsby-static-image/src/pages/fixed.js
  28. +35 −0 e2e-tests/gatsby-static-image/src/pages/fluid.js
  29. +18 −0 e2e-tests/gatsby-static-image/src/pages/index.js
  30. +35 −0 e2e-tests/gatsby-static-image/src/pages/intrinsic.js
  31. +32 −0 e2e-tests/gatsby-static-image/src/pages/traced.js
  32. +2 −0 e2e-tests/path-prefix/gatsby-config.js
  33. +2 −0 e2e-tests/path-prefix/package.json
  34. +2 −0 e2e-tests/path-prefix/src/pages/index.js
  35. +2 −0 e2e-tests/production-runtime/gatsby-config.js
  36. +2 −0 e2e-tests/production-runtime/package.json
  37. +2 −0 e2e-tests/production-runtime/src/components/header.js
  38. +1 −1 package.json
  39. +4 −0 packages/gatsby-admin/CHANGELOG.md
  40. +3 −3 packages/gatsby-admin/package.json
  41. +4 −0 packages/gatsby-cli/CHANGELOG.md
  42. +5 −5 packages/gatsby-cli/package.json
  43. +4 −1 packages/gatsby-cli/src/reporter/reporter.ts
  44. +3 −2 packages/gatsby-cli/src/structured-errors/error-map.ts
  45. +4 −0 packages/gatsby-plugin-emotion/CHANGELOG.md
  46. +17 −1 packages/gatsby-plugin-emotion/README.md
  47. +1 −1 packages/gatsby-plugin-emotion/package.json
  48. +24 −0 packages/gatsby-plugin-emotion/src/gatsby-node.js
  49. +3 −0 packages/gatsby-plugin-image/.babelrc
  50. +1 −0 packages/gatsby-plugin-image/.gitignore
  51. +8 −0 packages/gatsby-plugin-image/CHANGELOG.md
  52. +391 −0 packages/gatsby-plugin-image/README.md
  53. +1 −0 packages/gatsby-plugin-image/compat.browser.js
  54. +1 −0 packages/gatsby-plugin-image/compat.browser.modern.js
  55. +1 −0 packages/gatsby-plugin-image/compat.browser.module.js
  56. +1 −0 packages/gatsby-plugin-image/compat.js
  57. +2 −0 packages/gatsby-plugin-image/gatsby-node.js
  58. +29 −0 packages/gatsby-plugin-image/macros/cssnano.macro.js
  59. +27 −0 packages/gatsby-plugin-image/macros/terser.macro.js
  60. +94 −0 packages/gatsby-plugin-image/package.json
  61. +40 −0 packages/gatsby-plugin-image/src/babel-helpers.ts
  62. +112 −0 packages/gatsby-plugin-image/src/babel-plugin-parse-static-images.ts
  63. +153 −0 packages/gatsby-plugin-image/src/components/compat.browser.tsx
  64. +7 −0 packages/gatsby-plugin-image/src/components/compat.tsx
  65. +187 −0 packages/gatsby-plugin-image/src/components/gatsby-image.browser.tsx
  66. +79 −0 packages/gatsby-plugin-image/src/components/gatsby-image.server.tsx
  67. +191 −0 packages/gatsby-plugin-image/src/components/hooks.ts
  68. +47 −0 packages/gatsby-plugin-image/src/components/intersection-observer.ts
  69. +77 −0 packages/gatsby-plugin-image/src/components/layout-wrapper.tsx
  70. +83 −0 packages/gatsby-plugin-image/src/components/lazy-hydrate.tsx
  71. +13 −0 packages/gatsby-plugin-image/src/components/main-image.tsx
  72. +129 −0 packages/gatsby-plugin-image/src/components/picture.tsx
  73. +38 −0 packages/gatsby-plugin-image/src/components/placeholder.tsx
  74. +85 −0 packages/gatsby-plugin-image/src/components/static-image.server.tsx
  75. +13 −0 packages/gatsby-plugin-image/src/components/static-image.tsx
  76. +42 −0 packages/gatsby-plugin-image/src/gatsby-node.ts
  77. +87 −0 packages/gatsby-plugin-image/src/gatsby-ssr.tsx
  78. +11 −0 packages/gatsby-plugin-image/src/global.d.ts
  79. +4 −0 packages/gatsby-plugin-image/src/index.browser.ts
  80. +4 −0 packages/gatsby-plugin-image/src/index.ts
  81. +67 −0 packages/gatsby-plugin-image/src/node-apis/get-custom-sharp-fields.ts
  82. +170 −0 packages/gatsby-plugin-image/src/node-apis/image-processing.ts
  83. +4 −0 packages/gatsby-plugin-image/src/node-apis/node-utils.ts
  84. +98 −0 packages/gatsby-plugin-image/src/node-apis/parser.ts
  85. +47 −0 packages/gatsby-plugin-image/src/node-apis/preprocess-source.ts
  86. +98 −0 packages/gatsby-plugin-image/src/node-apis/watcher.ts
  87. +4 −0 packages/gatsby-plugin-image/src/types.d.ts
  88. +149 −0 packages/gatsby-plugin-image/src/utils.ts
  89. +16 −0 packages/gatsby-plugin-image/tsconfig.json
  90. +4 −0 packages/gatsby-plugin-netlify/CHANGELOG.md
  91. +2 −2 packages/gatsby-plugin-netlify/package.json
  92. +4 −0 packages/gatsby-plugin-offline/CHANGELOG.md
  93. +2 −1 packages/gatsby-plugin-offline/package.json
  94. +81 −0 packages/gatsby-plugin-offline/src/__tests__/gatsby-node.js
  95. +44 −0 packages/gatsby-plugin-offline/src/gatsby-node.js
  96. +4 −0 packages/gatsby-plugin-sitemap/CHANGELOG.md
  97. +1 −1 packages/gatsby-plugin-sitemap/README.md
  98. +1 −1 packages/gatsby-plugin-sitemap/package.json
  99. +6 −0 packages/gatsby-plugin-typescript/CHANGELOG.md
  100. +1 −1 packages/gatsby-plugin-typescript/package.json
  101. +31 −0 packages/gatsby-plugin-typescript/src/__tests__/gatsby-node.js
  102. +15 −0 packages/gatsby-plugin-typescript/src/gatsby-node.js
  103. +4 −0 packages/gatsby-plugin-utils/CHANGELOG.md
  104. +2 −2 packages/gatsby-plugin-utils/package.json
  105. +2 −1 packages/gatsby-remark-images/.gitignore
  106. +4 −0 packages/gatsby-remark-images/CHANGELOG.md
  107. +2 −1 packages/gatsby-remark-images/package.json
  108. +63 −0 packages/gatsby-remark-images/src/__tests__/gatsby-node.js
  109. +75 −0 packages/gatsby-remark-images/src/gatsby-node.js
  110. +11 −0 packages/gatsby-source-contentful/CHANGELOG.md
  111. +3 −1 packages/gatsby-source-contentful/package.json
  112. +1 −158 packages/gatsby-source-contentful/src/__tests__/plugin-options.js
  113. +242 −52 packages/gatsby-source-contentful/src/gatsby-node.js
  114. +14 −5 packages/gatsby-source-contentful/src/normalize.js
  115. +0 −41 packages/gatsby-source-contentful/src/plugin-options.js
  116. +4 −0 packages/gatsby-transformer-remark/CHANGELOG.md
  117. +2 −2 packages/gatsby-transformer-remark/package.json
  118. +6 −0 packages/gatsby/CHANGELOG.md
  119. +4 −4 packages/gatsby/package.json
  120. +3 −0 packages/gatsby/src/bootstrap/load-plugins/__tests__/__snapshots__/load-plugins.ts.snap
  121. +2 −0 packages/gatsby/src/bootstrap/load-plugins/__tests__/load-plugins.ts
  122. +4 −1 packages/gatsby/src/query/file-parser.js
  123. +158 −81 yarn.lock
9 changes: 9 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -368,6 +368,13 @@ jobs:
test_path: e2e-tests/mdx
test_command: yarn test

e2e_tests_gatsby-static-image:
<<: *e2e-executor
steps:
- e2e-test:
test_path: e2e-tests/gatsby-static-image
test_command: yarn test

starters_validate:
executor: node
steps:
@@ -573,6 +580,8 @@ workflows:
<<: *e2e-test-workflow
- e2e_tests_gatsby-image:
<<: *e2e-test-workflow
- e2e_tests_gatsby-static-image:
<<: *e2e-test-workflow
- e2e_tests_development_runtime:
<<: *e2e-test-workflow
- e2e_tests_production_runtime:
3 changes: 1 addition & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -8,8 +8,7 @@ packages/*/scripts/**
**/dist/*
**/__testfixtures__/**
**/__tests__/fixtures/**
www/public
www/src/components/search-form/docsearch.min.js
www
peril
docs
plop-templates
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ benchmarks/**/public
e2e-tests/**/public
examples/**/public
integration-tests/**/public
www/public
www

# cache-dirs
**/.cache
1 change: 1 addition & 0 deletions e2e-tests/development-runtime/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -48,6 +48,7 @@ module.exports = {
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
},
},
`gatsby-plugin-image`,
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
// 'gatsby-plugin-offline',
1 change: 1 addition & 0 deletions e2e-tests/development-runtime/package.json
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
"author": "Dustin Schau <dustin@gatsbyjs.com>",
"dependencies": {
"gatsby": "^2.4.4",
"gatsby-plugin-image": "^0.0.1",
"gatsby-image": "^2.0.41",
"gatsby-plugin-manifest": "^2.0.17",
"gatsby-plugin-offline": "^2.1.0",
8 changes: 7 additions & 1 deletion e2e-tests/development-runtime/src/components/image.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react"
import { StaticQuery, graphql } from "gatsby"
import Img from "gatsby-image"
import { StaticImage } from "gatsby-plugin-image"

/*
* This component is built using `gatsby-image` to automatically serve optimized
@@ -26,7 +27,12 @@ const Image = () => (
}
}
`}
render={data => <Img fluid={data.placeholderImage.childImageSharp.fluid} />}
render={data => (
<div>
<StaticImage src="../images/gatsby-icon.png" />
<Img fluid={data.placeholderImage.childImageSharp.fluid} />
</div>
)}
/>
)
export default Image
11 changes: 11 additions & 0 deletions e2e-tests/gatsby-static-image/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Project dependencies
.cache
node_modules
yarn-error.log

# Build directory
/public
.DS_Store

# Cypress output
cypress/videos/
22 changes: 22 additions & 0 deletions e2e-tests/gatsby-static-image/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2015 gatsbyjs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

30 changes: 30 additions & 0 deletions e2e-tests/gatsby-static-image/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# gatsby-starter-default

The default Gatsby starter.

For an overview of the project structure please refer to the [Gatsby documentation - Building with Components](https://www.gatsbyjs.org/docs/building-with-components/).

## Install

Make sure that you have the Gatsby CLI program installed:

```shell
npm install --global gatsby-cli
```

And run from your CLI:

```shell
gatsby new gatsby-example-site
```

Then you can run it by:

```shell
cd gatsby-example-site
gatsby develop
```

## Deploy

[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/gatsbyjs/gatsby-starter-default)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions e2e-tests/gatsby-static-image/cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"baseUrl": "http://localhost:9000"
}
5 changes: 5 additions & 0 deletions e2e-tests/gatsby-static-image/cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
72 changes: 72 additions & 0 deletions e2e-tests/gatsby-static-image/cypress/integration/fixed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
const fixedTestId = `image-fixed`

describe(`fixed`, () => {
beforeEach(() => {
cy.visit(`/fixed`).waitForRouteChange()
})

it(`does not render a spacer div`, () => {
cy.getTestElement(fixedTestId)
.find(`.gatsby-image-wrapper > div`)
.should(`not.exist`)
})

it(`applies height and width to wrapper`, () => {
cy.getTestElement(fixedTestId)
.find(`.gatsby-image-wrapper`)
.should(`have.attr`, `style`)
.and(style => {
;[`height:`, `width:`].forEach(part => {
expect(style).contains(part)
})
})
})

it(`works on png files`, () => {
cy.getTestElement(`image-fixed-png`)
.find(`.gatsby-image-wrapper`)
.should(`exist`)
})

it(`works on relative paths outside of src`, () => {
cy.getTestElement(`image-fixed-relative`)
.find(`.gatsby-image-wrapper`)
.should(`exist`)
})

// it(`applies 1x/2x`, () => {
// cy.getTestElement(fixedTestId)
// .find(`picture > source`)
// .should(`have.attr`, `srcset`)
// .and(srcset => {
// ;[`1x`, `2x`].forEach(size => {
// expect(srcset).contains(size)
// })
// })
// })

// it(`does not apply 3x`, () => {
// cy.getTestElement(fixedTestId)
// .find(`picture > source`)
// .should(`have.attr`, `srcset`)
// .and(srcset => {
// expect(srcset).not.contains(`3x`)
// })
// })

// describe(`picture > img sizing`, () => {
// it(`applies height attribute`, () => {
// cy.getTestElement(fixedTestId)
// .find(`picture > img`)
// .should(`have.attr`, `height`)
// .and(`match`, /^\d+$/)
// })

// it(`applies width attribute`, () => {
// cy.getTestElement(fixedTestId)
// .find(`picture > img`)
// .should(`have.attr`, `width`)
// .and(`match`, /^\d+$/)
// })
// })
})
26 changes: 26 additions & 0 deletions e2e-tests/gatsby-static-image/cypress/integration/fluid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const fluidTestId = `image-fluid`

describe(`fluid`, () => {
beforeEach(() => {
cy.visit(`/fluid`).waitForRouteChange()
})

it(`works on png files`, () => {
cy.getTestElement(`image-fluid-png`)
.find(`.gatsby-image-wrapper`)
.should(`exist`)
})

it(`works on relative paths outside of src`, () => {
cy.getTestElement(`image-fluid-relative`)
.find(`.gatsby-image-wrapper`)
.should(`exist`)
})

it(`renders a spacer div`, () => {
cy.getTestElement(fluidTestId)
.find(`.gatsby-image-wrapper > div`)
.should(`have.attr`, `style`)
.and(`match`, /padding/)
})
})
42 changes: 42 additions & 0 deletions e2e-tests/gatsby-static-image/cypress/integration/image.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const fluidTestId = `image-fluid`

describe(`Production gatsby-image`, () => {
beforeEach(() => {
cy.visit(`/fluid`).waitForRouteChange()
})

describe(`wrapping elements`, () => {
describe(`outer div`, () => {
it(`exists`, () => {
cy.getTestElement(fluidTestId)
.find(`.gatsby-image-wrapper`)
.its(`length`)
.should(`eq`, 1)
})

it(`contains position relative`, () => {
cy.getTestElement(fluidTestId)
.find(`.gatsby-image-wrapper`)
.should(`have.attr`, `style`)
.and(`contains`, `position:relative`)
})
})
})

describe(`invalid image`, () => {
it(`will not appear`, () => {
cy.getTestElement(`invalid-image`)
.find(`.gatsby-image-wrapper`)
.should(`not.exist`)
})
})

describe(`fallback image`, () => {
it(`renders base-64 src`, () => {
cy.getTestElement(fluidTestId)
.find(`.gatsby-image-wrapper > img`)
.should(`have.attr`, `src`)
.and(`contains`, `base64`)
})
})
})
28 changes: 28 additions & 0 deletions e2e-tests/gatsby-static-image/cypress/integration/traced.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const tracedTestId = `image-traced`

describe(`fixed`, () => {
beforeEach(() => {
cy.visit(`/traced`).waitForRouteChange()
})

it(`renders a traced svg`, () => {
cy.getTestElement(tracedTestId)
.find(`.gatsby-image-wrapper > img`)
.should(`have.attr`, `src`)
.and(src => {
;[`data:image/svg+xml`].forEach(part => expect(src).to.include(part))
})
})

it(`works on png files`, () => {
cy.getTestElement(`image-traced-png`)
.find(`.gatsby-image-wrapper`)
.should(`exist`)
})

it(`works on relative paths outside of src`, () => {
cy.getTestElement(`image-traced-relative`)
.find(`.gatsby-image-wrapper`)
.should(`exist`)
})
})
17 changes: 17 additions & 0 deletions e2e-tests/gatsby-static-image/cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************

// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)

module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}
16 changes: 16 additions & 0 deletions e2e-tests/gatsby-static-image/cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

import "gatsby-cypress"
11 changes: 11 additions & 0 deletions e2e-tests/gatsby-static-image/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const path = require(`path`)

module.exports = {
siteMetadata: {
title: `Gatsby Image e2e`,
},
plugins: [
`gatsby-plugin-sharp`,
`gatsby-plugin-image`
],
}
Loading