File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ var elementsWithNoTextChildren = new Set([
112
112
] ) ;
113
113
114
114
/**
115
- * Returns True if the the given node can contains text nodes
115
+ * Returns True if the the given node can contain text nodes
116
116
* @param {DomElement } node
117
117
* @returns {boolean }
118
118
*/
@@ -125,5 +125,6 @@ module.exports = {
125
125
invertObject : invertObject ,
126
126
isCustomComponent : isCustomComponent ,
127
127
setStyleProp : setStyleProp ,
128
- canTextBeChildOfNode : canTextBeChildOfNode
128
+ canTextBeChildOfNode : canTextBeChildOfNode ,
129
+ elementsWithNoTextChildren : elementsWithNoTextChildren
129
130
} ;
Original file line number Diff line number Diff line change 3
3
PRESERVE_CUSTOM_ATTRIBUTES ,
4
4
invertObject,
5
5
isCustomComponent,
6
- setStyleProp
6
+ setStyleProp,
7
+ elementsWithNoTextChildren,
8
+ canTextBeChildOfNode
7
9
} = require ( '../lib/utilities' ) ;
8
10
9
11
describe ( 'invertObject' , ( ) => {
@@ -125,3 +127,22 @@ describe('setStyleProp', () => {
125
127
expect ( props ) . toEqual ( { style : { } } ) ;
126
128
} ) ;
127
129
} ) ;
130
+
131
+ describe ( 'canTextBeChildOfNode' , ( ) => {
132
+ it . each ( Array . from ( elementsWithNoTextChildren ) ) (
133
+ 'returns false since text node can not be child of %s' ,
134
+ nodeName => {
135
+ const node = {
136
+ name : nodeName
137
+ } ;
138
+ expect ( canTextBeChildOfNode ( node ) ) . toBe ( false ) ;
139
+ }
140
+ ) ;
141
+
142
+ it ( 'returns true if text can be child of <td/>' , ( ) => {
143
+ const node = {
144
+ name : 'td'
145
+ } ;
146
+ expect ( canTextBeChildOfNode ( node ) ) . toBe ( true ) ;
147
+ } ) ;
148
+ } ) ;
You can’t perform that action at this time.
0 commit comments