Skip to content

Commit 53a1303

Browse files
committed
Render empty blocks add test
1 parent e604908 commit 53a1303

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

sample/__tests__/components/DraftJsText.test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,16 @@ it('renders text-align: center', () => {
115115
/>).toJSON();
116116
expect(tree).toMatchSnapshot();
117117
});
118+
119+
it('renders empty blocks', () => {
120+
const text = '';
121+
const tree = renderer.create(<DraftJsText
122+
type="paragraph"
123+
text={text}
124+
inlineStyles={[]}
125+
entityRanges={[]}
126+
entityMap={{}}
127+
renderEmptyBlocks
128+
/>).toJSON();
129+
expect(tree).toMatchSnapshot();
130+
});

sample/__tests__/components/__snapshots__/DraftJsText.test.js.snap

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,25 @@ exports[`renders correctly with a text 1`] = `
6262
</Text>
6363
`;
6464

65+
exports[`renders empty blocks 1`] = `
66+
<Text
67+
style={
68+
Array [
69+
Object {
70+
"fontSize": 14,
71+
"fontWeight": "normal",
72+
},
73+
Object {
74+
"textAlign": undefined,
75+
},
76+
undefined,
77+
]
78+
}
79+
>
80+
81+
</Text>
82+
`;
83+
6584
exports[`renders null without a text 1`] = `null`;
6685

6786
exports[`renders text-align: center 1`] = `

0 commit comments

Comments
 (0)