Skip to content

Commit 1929474

Browse files
committed
[change] Incorrect image test name
As we can see by the created snapshot - the image is rendered This is because there's no default source. In such case we render the Image source while it loads
1 parent e77deca commit 1929474

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

packages/react-native-web/src/exports/Image/__tests__/__snapshots__/index-test.js.snap

+10-10
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ exports[`components/Image prop "source" is correctly updated when missing in ini
255255
</div>
256256
`;
257257

258-
exports[`components/Image prop "source" is not set immediately if the image has not already been loaded 1`] = `
258+
exports[`components/Image prop "source" is set immediately if the image has already been loaded 1`] = `
259259
<div
260260
class="css-view-175oi2r r-flexBasis-1mlwlqe r-overflow-1udh08x r-zIndex-417010"
261261
>
@@ -272,53 +272,53 @@ exports[`components/Image prop "source" is not set immediately if the image has
272272
</div>
273273
`;
274274

275-
exports[`components/Image prop "source" is set immediately if the image has already been loaded 1`] = `
275+
exports[`components/Image prop "source" is set immediately if the image has already been loaded 2`] = `
276276
<div
277277
class="css-view-175oi2r r-flexBasis-1mlwlqe r-overflow-1udh08x r-zIndex-417010"
278278
>
279279
<div
280280
class="css-view-175oi2r r-backgroundColor-1niwhzg r-backgroundPosition-vvn4in r-backgroundRepeat-u6sd8q r-bottom-1p0dtai r-height-1pi2tsx r-left-1d2f490 r-position-u8s1d r-right-zchlnj r-top-ipm5af r-width-13qz1uu r-zIndex-1wyyakw r-backgroundSize-4gszlv"
281-
style="background-image: url(https://google.com/favicon.ico);"
281+
style="background-image: url(https://twitter.com/favicon.ico);"
282282
/>
283283
<img
284284
alt=""
285285
class="css-accessibilityImage-9pa8cd"
286286
draggable="false"
287-
src="https://google.com/favicon.ico"
287+
src="https://twitter.com/favicon.ico"
288288
/>
289289
</div>
290290
`;
291291

292-
exports[`components/Image prop "source" is set immediately if the image has already been loaded 2`] = `
292+
exports[`components/Image prop "source" is set immediately if the image was preloaded 1`] = `
293293
<div
294294
class="css-view-175oi2r r-flexBasis-1mlwlqe r-overflow-1udh08x r-zIndex-417010"
295295
>
296296
<div
297297
class="css-view-175oi2r r-backgroundColor-1niwhzg r-backgroundPosition-vvn4in r-backgroundRepeat-u6sd8q r-bottom-1p0dtai r-height-1pi2tsx r-left-1d2f490 r-position-u8s1d r-right-zchlnj r-top-ipm5af r-width-13qz1uu r-zIndex-1wyyakw r-backgroundSize-4gszlv"
298-
style="background-image: url(https://twitter.com/favicon.ico);"
298+
style="background-image: url(https://yahoo.com/favicon.ico);"
299299
/>
300300
<img
301301
alt=""
302302
class="css-accessibilityImage-9pa8cd"
303303
draggable="false"
304-
src="https://twitter.com/favicon.ico"
304+
src="https://yahoo.com/favicon.ico"
305305
/>
306306
</div>
307307
`;
308308

309-
exports[`components/Image prop "source" is set immediately if the image was preloaded 1`] = `
309+
exports[`components/Image prop "source" is set immediately while image is loading and there is no default source 1`] = `
310310
<div
311311
class="css-view-175oi2r r-flexBasis-1mlwlqe r-overflow-1udh08x r-zIndex-417010"
312312
>
313313
<div
314314
class="css-view-175oi2r r-backgroundColor-1niwhzg r-backgroundPosition-vvn4in r-backgroundRepeat-u6sd8q r-bottom-1p0dtai r-height-1pi2tsx r-left-1d2f490 r-position-u8s1d r-right-zchlnj r-top-ipm5af r-width-13qz1uu r-zIndex-1wyyakw r-backgroundSize-4gszlv"
315-
style="background-image: url(https://yahoo.com/favicon.ico);"
315+
style="background-image: url(https://google.com/not-yet-loaded-image.ico);"
316316
/>
317317
<img
318318
alt=""
319319
class="css-accessibilityImage-9pa8cd"
320320
draggable="false"
321-
src="https://yahoo.com/favicon.ico"
321+
src="https://google.com/not-yet-loaded-image.ico"
322322
/>
323323
</div>
324324
`;

packages/react-native-web/src/exports/Image/__tests__/index-test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ describe('components/Image', () => {
248248
});
249249
});
250250

251-
test('is not set immediately if the image has not already been loaded', () => {
252-
const uri = 'https://google.com/favicon.ico';
251+
test('is set immediately while image is loading and there is no default source', () => {
252+
const uri = 'https://google.com/not-yet-loaded-image.ico';
253253
const source = { uri };
254254
const { container } = render(<Image source={source} />);
255255
expect(container.firstChild).toMatchSnapshot();

0 commit comments

Comments
 (0)