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([
112112] ) ;
113113
114114/**
115- * Returns True if the the given node can contains text nodes
115+ * Returns True if the the given node can contain text nodes
116116 * @param {DomElement } node
117117 * @returns {boolean }
118118 */
@@ -125,5 +125,6 @@ module.exports = {
125125 invertObject : invertObject ,
126126 isCustomComponent : isCustomComponent ,
127127 setStyleProp : setStyleProp ,
128- canTextBeChildOfNode : canTextBeChildOfNode
128+ canTextBeChildOfNode : canTextBeChildOfNode ,
129+ elementsWithNoTextChildren : elementsWithNoTextChildren
129130} ;
Original file line number Diff line number Diff line change 33 PRESERVE_CUSTOM_ATTRIBUTES ,
44 invertObject,
55 isCustomComponent,
6- setStyleProp
6+ setStyleProp,
7+ elementsWithNoTextChildren,
8+ canTextBeChildOfNode
79} = require ( '../lib/utilities' ) ;
810
911describe ( 'invertObject' , ( ) => {
@@ -125,3 +127,22 @@ describe('setStyleProp', () => {
125127 expect ( props ) . toEqual ( { style : { } } ) ;
126128 } ) ;
127129} ) ;
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