Skip to content

Commit f5dab4f

Browse files
authored
fix(contentful): base64 previews now reflect all query options (#32709)
1 parent 6daead6 commit f5dab4f

File tree

5 files changed

+70
-14
lines changed

5 files changed

+70
-14
lines changed

e2e-tests/contentful/cypress/integration/gatsby-image.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ function hasSVGPlaceholder(el) {
1313
})
1414
}
1515

16-
function hasJPEGPlaceholder(el) {
16+
function hasBase64Placeholder(el) {
1717
el.children(`img`)
1818
.should(`have.attr`, `src`)
1919
.and(src => {
20-
expect(src).to.match(/^data:image\/jpeg/)
20+
expect(src).to.match(/^data:image\/[a-z]+;base64/)
2121
})
2222
}
2323

@@ -49,21 +49,21 @@ describe(`gatsby-image`, () => {
4949
beforeEach(() => {
5050
cy.visit("/gatsby-image").waitForRouteChange()
5151
})
52-
it(`fluid`, testConfig, () => testGatsbyImage(`fluid`, hasJPEGPlaceholder))
53-
it(`fixed`, testConfig, () => testGatsbyImage(`fixed`, hasJPEGPlaceholder))
54-
it(`webp`, testConfig, () => testGatsbyImage(`webp`, hasJPEGPlaceholder))
52+
it(`fluid`, testConfig, () => testGatsbyImage(`fluid`, hasBase64Placeholder))
53+
it(`fixed`, testConfig, () => testGatsbyImage(`fixed`, hasBase64Placeholder))
54+
it(`webp`, testConfig, () => testGatsbyImage(`webp`, hasBase64Placeholder))
5555
it(`traced`, testConfig, () => testGatsbyImage(`traced`, hasSVGPlaceholder))
5656
it(`sqip`, testConfig, () => testGatsbyImage(`sqip`, hasSVGPlaceholder))
5757

5858
it(`english`, testConfig, () => {
59-
testGatsbyImage(`english`, hasJPEGPlaceholder)
59+
testGatsbyImage(`english`, hasBase64Placeholder)
6060
cy.get(`[data-cy="english"] p strong`).should(
6161
"have.text",
6262
"Locale - American English (png)"
6363
)
6464
})
6565
it(`german`, testConfig, () => {
66-
testGatsbyImage(`german`, hasJPEGPlaceholder)
66+
testGatsbyImage(`german`, hasBase64Placeholder)
6767
cy.get(`[data-cy="german"] p strong`).should(
6868
"have.text",
6969
"Locale - German (png)"

e2e-tests/contentful/cypress/integration/gatsby-plugin-image.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ function hasSVGPlaceholder(el) {
1313
})
1414
}
1515

16-
function hasJPEGPlaceholder(el) {
16+
function hasBase64Placeholder(el) {
1717
el.children(`img`)
1818
.should(`have.attr`, `src`)
1919
.and(src => {
20-
expect(src).to.match(/^data:image\/jpeg;base64/)
20+
expect(src).to.match(/^data:image\/[a-z]+;base64/)
2121
})
2222
}
2323

@@ -77,7 +77,7 @@ describe(`gatsby-plugin-image`, () => {
7777
testGatsbyPluginImage(`traced`, hasSVGPlaceholder)
7878
)
7979
it(`blurred`, testConfig, () =>
80-
testGatsbyPluginImage(`blurred`, hasJPEGPlaceholder)
80+
testGatsbyPluginImage(`blurred`, hasBase64Placeholder)
8181
)
8282
it(`sqip`, testConfig, () => testGatsbyPluginImage(`sqip`, hasSVGPlaceholder))
8383

0 commit comments

Comments
 (0)