ソースを参照

Merge pull request #35 from ckeditor/i/6219

Tests: Added integration tests for editors sharing props. Closes ckeditor/ckeditor5#6219.
Piotrek Koszuliński 5 年 前
コミット
390e3bf9e3

+ 50 - 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,53 @@ describe( 'areConnectedThroughProperties()', () => {
 
 		expect( areConnectedThroughProperties( el1, el2 ) ).to.be.true;
 	} );
+
+	describe( 'integration tests', () => {
+		afterEach( () => {
+			delete Editor.builtinPlugins;
+			delete Editor.defaultConfig;
+		} );
+
+		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;
+		} );
+
+		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;
+		} );
+
+		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;
+		} );
+	} );
 } );