Bladeren bron

Added integration tests.

Maciej Bukowski 5 jaren geleden
bovenliggende
commit
8cc74a17fb
1 gewijzigde bestanden met toevoegingen van 51 en 0 verwijderingen
  1. 51 0
      packages/ckeditor5-watchdog/tests/utils/areconnectedthroughproperties.js

+ 51 - 0
packages/ckeditor5-watchdog/tests/utils/areconnectedthroughproperties.js

@@ -6,6 +6,7 @@
 /* globals window, document, Event */
 
 import areConnectedThroughProperties from '../../src/utils/areconnectedthroughproperties';
+import Editor from '@ckeditor/ckeditor5-core/src/editor/editor';
 
 describe( 'areConnectedThroughProperties()', () => {
 	it( 'should return `false` if one of the value is primitive #1', () => {
@@ -247,4 +248,54 @@ describe( 'areConnectedThroughProperties()', () => {
 
 		expect( areConnectedThroughProperties( el1, el2 ) ).to.be.true;
 	} );
+
+	describe( 'integration tests', () => {
+		it( 'should return false for two different editors', () => {
+			const editor1 = new Editor( {} );
+			const editor2 = new Editor( {} );
+
+			expect( areConnectedThroughProperties( editor1, editor2 ) ).to.be.false;
+		} );
+
+		it( 'should return false for two different editors sharing builtin plugins', () => {
+			class FakePlugin {}
+
+			Editor.builtinPlugins = [ FakePlugin ];
+
+			const editor1 = new Editor();
+			const editor2 = new Editor();
+
+			expect( areConnectedThroughProperties( editor1, editor2 ) ).to.be.false;
+
+			delete Editor.builtinPlugins;
+		} );
+
+		it( 'should return false for two different editors inheriting default configuration', () => {
+			Editor.defaultConfig = {
+				foo: {
+					bar: []
+				}
+			};
+
+			const editor1 = new Editor();
+			const editor2 = new Editor();
+
+			expect( areConnectedThroughProperties( editor1, editor2 ) ).to.be.false;
+
+			delete Editor.defaultConfig;
+		} );
+
+		it( 'should return false for two different editors sharing builtin plugins', () => {
+			Editor.builtinPlugins = [
+				class Foo {}
+			];
+
+			const editor1 = new Editor();
+			const editor2 = new Editor();
+
+			expect( areConnectedThroughProperties( editor1, editor2 ) ).to.be.false;
+
+			delete Editor.builtinPlugins;
+		} );
+	} );
 } );