8
0
Maciej Bukowski 6 лет назад
Родитель
Сommit
2c07d8df52

+ 5 - 5
packages/ckeditor5-watchdog/src/utils/getsubnodes.js

@@ -33,7 +33,7 @@ export default function getSubNodes( head, excludedProperties = new Set() ) {
 				for ( const n of node ) {
 					nodes.push( n );
 
-					// @if CK_DEBUG_WATCHDOG // if ( !prevNodeMap.has( node[ key ] ) ) {
+					// @if CK_DEBUG_WATCHDOG // if ( !prevNodeMap.has( n ) ) {
 					// @if CK_DEBUG_WATCHDOG // 	prevNodeMap.set( n, node );
 					// @if CK_DEBUG_WATCHDOG // }
 				}
@@ -44,17 +44,17 @@ export default function getSubNodes( head, excludedProperties = new Set() ) {
 			}
 		} else {
 			for ( const key in node ) {
-				// We share references (objects) in the ProtobufFactory within the editors,
-				// hence the whole object should be skipped. Although, it's not a perfect
+				// We share a reference via the protobuf library within the editors,
+				// hence the shared value should be skipped. Although, it's not a perfect
 				// solution since new places like that might occur in the future.
-				if ( key === 'nested' ) {
+				if ( key === 'defaultValue' ) {
 					continue;
 				}
 
 				nodes.push( node[ key ] );
 
 				// @if CK_DEBUG_WATCHDOG // if ( !prevNodeMap.has( node[ key ] ) ) {
-				// @if CK_DEBUG_WATCHDOG // 	prevNodeMap.set( n, node );
+				// @if CK_DEBUG_WATCHDOG // 	prevNodeMap.set( node[ key ], node );
 				// @if CK_DEBUG_WATCHDOG // }
 			}
 		}

+ 12 - 3
packages/ckeditor5-watchdog/tests/areconnectedthroughproperties.js

@@ -230,12 +230,21 @@ describe( 'areConnectedThroughProperties()', () => {
 		expect( areConnectedThroughProperties( el1, el2, new Set( [ shared ] ) ) ).to.be.true;
 	} );
 
-	it( 'should skip the `nested` key since we share props withing ', () => {
+	it( 'should skip the `defaultValue` key since its commonly shared between editors', () => {
 		const shared = {};
 
-		const el1 = { nested: shared };
-		const el2 = { nested: shared };
+		const el1 = { defaultValue: shared };
+		const el2 = { defaultValue: shared };
 
 		expect( areConnectedThroughProperties( el1, el2 ) ).to.be.false;
 	} );
+
+	it( 'should skip the `defaultValue` key since its commonly shared between editors #2', () => {
+		const shared = {};
+
+		const el1 = { defaultValue: shared, shared };
+		const el2 = { defaultValue: shared, shared };
+
+		expect( areConnectedThroughProperties( el1, el2 ) ).to.be.true;
+	} );
 } );