Ver código fonte

Added basic tests to Bold feature, requiring BoldEngine from it.

Szymon Kupś 9 anos atrás
pai
commit
5a1acac8bb

+ 5 - 0
packages/ckeditor5-basic-styles/src/bold.js

@@ -6,8 +6,13 @@
 'use strict';
 
 import Feature from '../feature.js';
+import BoldEngine from './boldengine.js';
 
 export default class Bold extends Feature {
+	static get requires() {
+		return [ BoldEngine ];
+	}
+
 	init() {
 	}
 }

+ 32 - 0
packages/ckeditor5-basic-styles/tests/bold.js

@@ -0,0 +1,32 @@
+/**
+ * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+'use strict';
+
+import Editor from '/ckeditor5/editor.js';
+import Bold from '/ckeditor5/basic-styles/bold.js';
+import BoldEngine from '/ckeditor5/basic-styles/boldengine.js';
+import StandardCreator from '/ckeditor5/creator/standardcreator.js';
+
+describe( 'Bold', () => {
+	let editor;
+
+	beforeEach( () => {
+		editor = new Editor( null, {
+			creator: StandardCreator,
+			features: [ Bold ]
+		} );
+
+		return editor.init();
+	} );
+
+	it( 'should be loaded', () => {
+		expect( editor.plugins.get( Bold ) ).to.be.instanceOf( Bold );
+	} );
+
+	it( 'should load BoldEngine', () => {
+		expect( editor.plugins.get( BoldEngine ) ).to.be.instanceOf( BoldEngine );
+	} );
+} );