@@ -44,17 +44,19 @@ const initializeAsNonIE = () => {
44
44
} ;
45
45
46
46
const expectPopulatedSpan = ( stub , testString ) => {
47
- const node = ReactDOM . findDOMNode ( stub ) ;
47
+ // $FlowExpectedError node could be null
48
+ const node : Element = ReactDOM . findDOMNode ( stub ) ;
48
49
expect ( node . tagName ) . toBe ( 'SPAN' ) ;
49
50
expect ( node . childNodes . length ) . toBe ( 1 ) ;
50
- expect ( node . firstChild . textContent ) . toBe ( testString ) ;
51
+ expect ( node . firstChild && node . firstChild . textContent ) . toBe ( testString ) ;
51
52
} ;
52
53
53
54
test ( 'must initialize correctly with an empty string, non-IE' , function ( ) {
54
55
initializeAsNonIE ( ) ;
55
56
const stub = renderIntoContainer (
56
57
< DraftEditorTextNode > { '' } </ DraftEditorTextNode > ,
57
58
) ;
59
+ // $FlowExpectedError we know node is an Element
58
60
expect ( ReactDOM . findDOMNode ( stub ) . tagName ) . toBe ( 'BR' ) ;
59
61
} ) ;
60
62
@@ -143,11 +145,13 @@ test('must skip updates if text already matches DOM, non-IE', function() {
143
145
144
146
renderIntoContainer ( < DraftEditorTextNode > { TEST_A } </ DraftEditorTextNode > ) ;
145
147
148
+ // $FlowExpectedError property render is missing in HTMLDivElement
146
149
expect ( stub . render . mock . calls . length ) . toBe ( 0 ) ;
147
150
148
151
// Sanity check that updating is performed when appropriate.
149
152
renderIntoContainer ( < DraftEditorTextNode > { TEST_B } </ DraftEditorTextNode > ) ;
150
153
154
+ // $FlowExpectedError property render is missing in HTMLDivElement
151
155
expect ( stub . render . mock . calls . length ) . toBe ( 1 ) ;
152
156
} ) ;
153
157
@@ -161,11 +165,13 @@ test('must skip updates if text already matches DOM, IE', function() {
161
165
162
166
renderIntoContainer ( < DraftEditorTextNode > { TEST_A } </ DraftEditorTextNode > ) ;
163
167
168
+ // $FlowExpectedError property render is missing in HTMLDivElement
164
169
expect ( stub . render . mock . calls . length ) . toBe ( 0 ) ;
165
170
166
171
// Sanity check that updating is performed when appropriate.
167
172
renderIntoContainer ( < DraftEditorTextNode > { TEST_B } </ DraftEditorTextNode > ) ;
168
173
174
+ // $FlowExpectedError property render is missing in HTMLDivElement
169
175
expect ( stub . render . mock . calls . length ) . toBe ( 1 ) ;
170
176
} ) ;
171
177
@@ -177,6 +183,7 @@ test('must update from non-empty to empty, non-IE', function() {
177
183
178
184
renderIntoContainer ( < DraftEditorTextNode > { '' } </ DraftEditorTextNode > ) ;
179
185
186
+ // $FlowExpectedError we know node is an Element
180
187
expect ( ReactDOM . findDOMNode ( stub ) . tagName ) . toBe ( 'BR' ) ;
181
188
} ) ;
182
189
@@ -206,9 +213,11 @@ test('must force unchanged text back into the DOM', function() {
206
213
< DraftEditorTextNode > { TEST_A } </ DraftEditorTextNode > ,
207
214
) ;
208
215
216
+ // $FlowExpectedError we know node is not null
209
217
ReactDOM . findDOMNode ( stub ) . textContent = TEST_B ;
210
218
211
219
renderIntoContainer ( < DraftEditorTextNode > { TEST_A } </ DraftEditorTextNode > ) ;
212
220
221
+ // $FlowExpectedError we know node is not null
213
222
expect ( ReactDOM . findDOMNode ( stub ) . textContent ) . toBe ( TEST_A ) ;
214
223
} ) ;
0 commit comments