File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -152,5 +152,27 @@ describe('HTML to React', () => {
152
152
) ;
153
153
} ) ;
154
154
} ) ;
155
+
156
+ describe ( 'trim' , ( ) => {
157
+ it ( 'preserves whitespace text nodes when disabled (default)' , ( ) => {
158
+ const html = `<table>
159
+ <tbody>
160
+ </tbody>
161
+ </table>` ;
162
+ const reactElement = parse ( html ) ;
163
+ assert . strictEqual ( render ( reactElement ) , html ) ;
164
+ } ) ;
165
+
166
+ it ( 'removes whitespace text nodes when enabled' , ( ) => {
167
+ const html = `<table>
168
+ <tbody><tr><td> text </td><td> </td>\t</tr>\r</tbody>\n</table>` ;
169
+ const options = { trim : true } ;
170
+ const reactElement = parse ( html , options ) ;
171
+ assert . strictEqual (
172
+ render ( reactElement ) ,
173
+ '<table><tbody><tr><td> text </td><td></td></tr></tbody></table>'
174
+ ) ;
175
+ } ) ;
176
+ } ) ;
155
177
} ) ;
156
178
} ) ;
You can’t perform that action at this time.
0 commit comments