Skip to content

Commit 2da9529

Browse files
Added Image test when no name is provided
1 parent dbab8bf commit 2da9529

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/renderers/image/__snapshots__/index.test.tsx.snap

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ exports[`<Image /> when receives a Image block without actions renders a <figure
2929
</figure>
3030
`;
3131
32+
exports[`<Image /> when receives a Image block without name renders a <figure> block with <img> and <figcaption> 1`] = `
33+
<figure>
34+
<img
35+
alt="Deep in the universe"
36+
src="https://cdn.directions.pt/uploads/2020/08/681-2000x1300-2.jpg"
37+
/>
38+
<figcaption>
39+
Deep in the universe
40+
</figcaption>
41+
</figure>
42+
`;
43+
3244
exports[`<Image /> when receives a SimpleImage block renders a <figure> block with <img> and <figcaption> 1`] = `
3345
<figure>
3446
<img

src/renderers/image/index.test.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,22 @@ describe('<Image />', () => {
3737
});
3838
});
3939

40+
describe('when receives a Image block without name', () => {
41+
const data: ImageBlockData = {
42+
file: {
43+
url: 'https://cdn.directions.pt/uploads/2020/08/681-2000x1300-2.jpg',
44+
},
45+
caption: 'Deep in the universe',
46+
withBorder: false,
47+
stretched: false,
48+
withBackground: false,
49+
};
50+
51+
it('renders a <figure> block with <img> and <figcaption>', () => {
52+
expect(create(<Image data={data} />).toJSON()).toMatchSnapshot();
53+
});
54+
});
55+
4056
describe('when receives a SimpleImage block', () => {
4157
const data: ImageBlockData = {
4258
url: 'https://cdn.directions.pt/uploads/2020/08/681-2000x1300-2.jpg',

0 commit comments

Comments
 (0)