@@ -1272,10 +1272,15 @@ describe('ReactDOMComponent', () => {
1272
1272
spyOn ( console , 'error' ) ;
1273
1273
ReactTestUtils . renderIntoDocument ( < div > < tr /> < tr /> </ div > ) ;
1274
1274
1275
+ var addendum = ReactDOMFeatureFlags . useFiber ?
1276
+ '\n in tr (at **)' +
1277
+ '\n in div (at **)' :
1278
+ ' See div > tr.' ;
1279
+
1275
1280
expectDev ( console . error . calls . count ( ) ) . toBe ( 1 ) ;
1276
- expectDev ( console . error . calls . argsFor ( 0 ) [ 0 ] ) . toBe (
1281
+ expectDev ( normalizeCodeLocInfo ( console . error . calls . argsFor ( 0 ) [ 0 ] ) ) . toBe (
1277
1282
'Warning: validateDOMNesting(...): <tr> cannot appear as a child of ' +
1278
- '<div>. See div > tr.'
1283
+ '<div>.' + addendum
1279
1284
) ;
1280
1285
} ) ;
1281
1286
@@ -1284,10 +1289,16 @@ describe('ReactDOMComponent', () => {
1284
1289
var p = document . createElement ( 'p' ) ;
1285
1290
ReactDOM . render ( < span > < p /> </ span > , p ) ;
1286
1291
1292
+ var addendum = ReactDOMFeatureFlags . useFiber ?
1293
+ // There is no outer `p` here because root container is not part of the stack.
1294
+ '\n in p (at **)' +
1295
+ '\n in span (at **)' :
1296
+ ' See p > ... > p.' ;
1297
+
1287
1298
expectDev ( console . error . calls . count ( ) ) . toBe ( 1 ) ;
1288
- expectDev ( console . error . calls . argsFor ( 0 ) [ 0 ] ) . toBe (
1299
+ expectDev ( normalizeCodeLocInfo ( console . error . calls . argsFor ( 0 ) [ 0 ] ) ) . toBe (
1289
1300
'Warning: validateDOMNesting(...): <p> cannot appear as a descendant ' +
1290
- 'of <p>. See p > ... > p.'
1301
+ 'of <p>.' + addendum
1291
1302
) ;
1292
1303
} ) ;
1293
1304
@@ -1307,22 +1318,39 @@ describe('ReactDOMComponent', () => {
1307
1318
}
1308
1319
1309
1320
ReactTestUtils . renderIntoDocument ( < Foo /> ) ;
1310
-
1311
1321
expectDev ( console . error . calls . count ( ) ) . toBe ( 3 ) ;
1312
- expectDev ( console . error . calls . argsFor ( 0 ) [ 0 ] ) . toBe (
1322
+
1323
+ var addendum1 = ReactDOMFeatureFlags . useFiber ?
1324
+ '\n in tr (at **)' +
1325
+ '\n in Row (at **)' +
1326
+ '\n in table (at **)' +
1327
+ '\n in Foo (at **)' :
1328
+ ' See Foo > table > Row > tr.' ;
1329
+ expectDev ( normalizeCodeLocInfo ( console . error . calls . argsFor ( 0 ) [ 0 ] ) ) . toBe (
1313
1330
'Warning: validateDOMNesting(...): <tr> cannot appear as a child of ' +
1314
- '<table>. See Foo > table > Row > tr. Add a <tbody> to your code to ' +
1315
- 'match the DOM tree generated by the browser.'
1331
+ '<table>. Add a <tbody> to your code to match the DOM tree generated ' +
1332
+ 'by the browser.' + addendum1
1316
1333
) ;
1317
- expectDev ( console . error . calls . argsFor ( 1 ) [ 0 ] ) . toBe (
1334
+
1335
+ var addendum2 = ReactDOMFeatureFlags . useFiber ?
1336
+ '\n in tr (at **)' +
1337
+ '\n in Row (at **)' +
1338
+ '\n in table (at **)' +
1339
+ '\n in Foo (at **)' :
1340
+ ' See Row > tr > #text.' ;
1341
+ expectDev ( normalizeCodeLocInfo ( console . error . calls . argsFor ( 1 ) [ 0 ] ) ) . toBe (
1318
1342
'Warning: validateDOMNesting(...): Text nodes cannot appear as a ' +
1319
- 'child of <tr>. See Row > tr > #text.'
1343
+ 'child of <tr>.' + addendum2
1320
1344
) ;
1321
- expectDev ( console . error . calls . argsFor ( 2 ) [ 0 ] ) . toBe (
1345
+
1346
+ var addendum3 = ReactDOMFeatureFlags . useFiber ?
1347
+ '\n in table (at **)' +
1348
+ '\n in Foo (at **)' :
1349
+ ' See Foo > table > #text.' ;
1350
+ expectDev ( normalizeCodeLocInfo ( console . error . calls . argsFor ( 2 ) [ 0 ] ) ) . toBe (
1322
1351
'Warning: validateDOMNesting(...): Whitespace text nodes cannot ' +
1323
1352
'appear as a child of <table>. Make sure you don\'t have any extra ' +
1324
- 'whitespace between tags on each line of your source code. See Foo > ' +
1325
- 'table > #text.'
1353
+ 'whitespace between tags on each line of your source code.' + addendum3
1326
1354
) ;
1327
1355
} ) ;
1328
1356
@@ -1355,8 +1383,14 @@ describe('ReactDOMComponent', () => {
1355
1383
} ) ;
1356
1384
ReactTestUtils . renderIntoDocument ( < App1 /> ) ;
1357
1385
expectDev ( console . error . calls . count ( ) ) . toBe ( 1 ) ;
1358
- expectDev ( console . error . calls . argsFor ( 0 ) [ 0 ] ) . toContain (
1359
- 'See Viz1 > table > FancyRow > Row > tr.'
1386
+ expectDev ( normalizeCodeLocInfo ( console . error . calls . argsFor ( 0 ) [ 0 ] ) ) . toContain (
1387
+ ReactDOMFeatureFlags . useFiber ?
1388
+ '\n in tr (at **)' +
1389
+ '\n in Row (at **)' +
1390
+ '\n in FancyRow (at **)' +
1391
+ '\n in table (at **)' +
1392
+ '\n in Viz1 (at **)' :
1393
+ 'See Viz1 > table > FancyRow > Row > tr.'
1360
1394
) ;
1361
1395
1362
1396
var Viz2 = React . createClass ( {
@@ -1367,26 +1401,51 @@ describe('ReactDOMComponent', () => {
1367
1401
} ) ;
1368
1402
ReactTestUtils . renderIntoDocument ( < App2 /> ) ;
1369
1403
expectDev ( console . error . calls . count ( ) ) . toBe ( 2 ) ;
1370
- expectDev ( console . error . calls . argsFor ( 1 ) [ 0 ] ) . toContain (
1371
- 'See Viz2 > FancyTable > Table > table > FancyRow > Row > tr.'
1404
+ expectDev ( normalizeCodeLocInfo ( console . error . calls . argsFor ( 1 ) [ 0 ] ) ) . toContain (
1405
+ ReactDOMFeatureFlags . useFiber ?
1406
+ '\n in tr (at **)' +
1407
+ '\n in Row (at **)' +
1408
+ '\n in FancyRow (at **)' +
1409
+ '\n in table (at **)' +
1410
+ '\n in Table (at **)' +
1411
+ '\n in FancyTable (at **)' +
1412
+ '\n in Viz2 (at **)' :
1413
+ 'See Viz2 > FancyTable > Table > table > FancyRow > Row > tr.'
1372
1414
) ;
1373
1415
1374
1416
ReactTestUtils . renderIntoDocument ( < FancyTable > < FancyRow /> </ FancyTable > ) ;
1375
1417
expectDev ( console . error . calls . count ( ) ) . toBe ( 3 ) ;
1376
- expectDev ( console . error . calls . argsFor ( 2 ) [ 0 ] ) . toContain (
1377
- 'See FancyTable > Table > table > FancyRow > Row > tr.'
1418
+ expectDev ( normalizeCodeLocInfo ( console . error . calls . argsFor ( 2 ) [ 0 ] ) ) . toContain (
1419
+ ReactDOMFeatureFlags . useFiber ?
1420
+ '\n in tr (at **)' +
1421
+ '\n in Row (at **)' +
1422
+ '\n in FancyRow (at **)' +
1423
+ '\n in table (at **)' +
1424
+ '\n in Table (at **)' +
1425
+ '\n in FancyTable (at **)' :
1426
+ 'See FancyTable > Table > table > FancyRow > Row > tr.'
1378
1427
) ;
1379
1428
1380
1429
ReactTestUtils . renderIntoDocument ( < table > < FancyRow /> </ table > ) ;
1381
1430
expectDev ( console . error . calls . count ( ) ) . toBe ( 4 ) ;
1382
- expectDev ( console . error . calls . argsFor ( 3 ) [ 0 ] ) . toContain (
1383
- 'See table > FancyRow > Row > tr.'
1431
+ expectDev ( normalizeCodeLocInfo ( console . error . calls . argsFor ( 3 ) [ 0 ] ) ) . toContain (
1432
+ ReactDOMFeatureFlags . useFiber ?
1433
+ '\n in tr (at **)' +
1434
+ '\n in Row (at **)' +
1435
+ '\n in FancyRow (at **)' +
1436
+ '\n in table (at **)' :
1437
+ 'See table > FancyRow > Row > tr.'
1384
1438
) ;
1385
1439
1386
1440
ReactTestUtils . renderIntoDocument ( < FancyTable > < tr /> </ FancyTable > ) ;
1387
1441
expectDev ( console . error . calls . count ( ) ) . toBe ( 5 ) ;
1388
- expectDev ( console . error . calls . argsFor ( 4 ) [ 0 ] ) . toContain (
1389
- 'See FancyTable > Table > table > tr.'
1442
+ expectDev ( normalizeCodeLocInfo ( console . error . calls . argsFor ( 4 ) [ 0 ] ) ) . toContain (
1443
+ ReactDOMFeatureFlags . useFiber ?
1444
+ '\n in tr (at **)' +
1445
+ '\n in table (at **)' +
1446
+ '\n in Table (at **)' +
1447
+ '\n in FancyTable (at **)' :
1448
+ 'See FancyTable > Table > table > tr.'
1390
1449
) ;
1391
1450
1392
1451
class Link extends React . Component {
@@ -1397,8 +1456,14 @@ describe('ReactDOMComponent', () => {
1397
1456
1398
1457
ReactTestUtils . renderIntoDocument ( < Link > < div > < Link /> </ div > </ Link > ) ;
1399
1458
expectDev ( console . error . calls . count ( ) ) . toBe ( 6 ) ;
1400
- expectDev ( console . error . calls . argsFor ( 5 ) [ 0 ] ) . toContain (
1401
- 'See Link > a > ... > Link > a.'
1459
+ expectDev ( normalizeCodeLocInfo ( console . error . calls . argsFor ( 5 ) [ 0 ] ) ) . toContain (
1460
+ ReactDOMFeatureFlags . useFiber ?
1461
+ '\n in a (at **)' +
1462
+ '\n in Link (at **)' +
1463
+ '\n in div (at **)' +
1464
+ '\n in a (at **)' +
1465
+ '\n in Link (at **)' :
1466
+ 'See Link > a > ... > Link > a.'
1402
1467
) ;
1403
1468
} ) ;
1404
1469
0 commit comments