mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Fix ReactComponentTreeHook.getRegisteredIDs() to work with inlined content (#7490)
I broke this in #7463: parseInt() cuts off #text at the end. Changing to just use negative numbers instead.
This commit is contained in:
@@ -259,7 +259,8 @@ if (__DEV__) {
|
||||
setContentChildForInstrumentation = function(content) {
|
||||
var hasExistingContent = this._contentDebugID != null;
|
||||
var debugID = this._debugID;
|
||||
var contentDebugID = debugID + '#text';
|
||||
// This ID represents the inlined child that has no backing instance:
|
||||
var contentDebugID = -debugID;
|
||||
|
||||
if (content == null) {
|
||||
if (hasExistingContent) {
|
||||
|
||||
@@ -1721,6 +1721,16 @@ describe('ReactComponentTreeHook', () => {
|
||||
expect(ReactComponentTreeTestUtils.getRegisteredDisplayNames()).toEqual([]);
|
||||
});
|
||||
|
||||
it('registers inlined text nodes', () => {
|
||||
var node = document.createElement('div');
|
||||
|
||||
ReactDOM.render(<div>hi</div>, node);
|
||||
expect(ReactComponentTreeTestUtils.getRegisteredDisplayNames()).toEqual(['div', '#text']);
|
||||
|
||||
ReactDOM.unmountComponentAtNode(node);
|
||||
expect(ReactComponentTreeTestUtils.getRegisteredDisplayNames()).toEqual([]);
|
||||
});
|
||||
|
||||
describe('stack addenda', () => {
|
||||
it('gets created', () => {
|
||||
function getAddendum(element) {
|
||||
|
||||
Reference in New Issue
Block a user