瀏覽代碼

Renamed TreeView#selectionchange to TreeView#selectionChange.

Piotr Jasiun 9 年之前
父節點
當前提交
66081f535f

+ 5 - 5
packages/ckeditor5-engine/src/treeview/observer/selectionobserver.js

@@ -12,7 +12,7 @@ import MutationObserver from './mutationobserver.js';
  * Selection observer class observes selection changes in the document. If selection changes on the document this
  * Selection observer class observes selection changes in the document. If selection changes on the document this
  * observer checks if there are any mutations and if DOM selection is different than the
  * observer checks if there are any mutations and if DOM selection is different than the
  * {@link engine.treeView.TreeView#selection view selection}. Selection observer fires
  * {@link engine.treeView.TreeView#selection view selection}. Selection observer fires
- * {@link engine.treeView.TreeView#selectionchange} event only if selection change was the only change in the document
+ * {@link engine.treeView.TreeView#selectionChange} event only if selection change was the only change in the document
  * and DOM selection is different then the view selection.
  * and DOM selection is different then the view selection.
  *
  *
  * @see engine.treeView.MutationObserver
  * @see engine.treeView.MutationObserver
@@ -26,7 +26,7 @@ export default class SelectionObserver extends Observer {
 		/**
 		/**
 		 * Instance of the mutation observer. Selection observer calls
 		 * Instance of the mutation observer. Selection observer calls
 		 * {@link engine.treeView.observer.MutationObserver#flush} to ensure that the mutations will be handled before the
 		 * {@link engine.treeView.observer.MutationObserver#flush} to ensure that the mutations will be handled before the
-		 * {@link engine.treeView.TreeView#selectionchange} event is fired.
+		 * {@link engine.treeView.TreeView#selectionChange} event is fired.
 		 *
 		 *
 		 * @readonly
 		 * @readonly
 		 * @member {engine.treeView.observer.MutationObserver} engine.treeView.observer.SelectionObserver#mutationObserver
 		 * @member {engine.treeView.observer.MutationObserver} engine.treeView.observer.SelectionObserver#mutationObserver
@@ -85,7 +85,7 @@ export default class SelectionObserver extends Observer {
 
 
 	/**
 	/**
 	 * Selection change listener. {@link engine.treeView.observer.MutationObserver#flush Flush} mutations, check if
 	 * Selection change listener. {@link engine.treeView.observer.MutationObserver#flush Flush} mutations, check if
-	 * selection changes and fires {@link engine.treeView.TreeView#selectionchange} event.
+	 * selection changes and fires {@link engine.treeView.TreeView#selectionChange} event.
 	 *
 	 *
 	 * @private
 	 * @private
 	 * @param {Document} domDocument DOM document.
 	 * @param {Document} domDocument DOM document.
@@ -108,7 +108,7 @@ export default class SelectionObserver extends Observer {
 		}
 		}
 
 
 		// Should be fired only when selection change was the only document change.
 		// Should be fired only when selection change was the only document change.
-		this.treeView.fire( 'selectionchange', {
+		this.treeView.fire( 'selectionChange', {
 			oldSelection: this.selection,
 			oldSelection: this.selection,
 			newSelection: newViewSelection,
 			newSelection: newViewSelection,
 			domSelection: domSelection
 			domSelection: domSelection
@@ -122,7 +122,7 @@ export default class SelectionObserver extends Observer {
  * Fired when selection has changed. This event is fired only when the selection change was the only change that happened
  * Fired when selection has changed. This event is fired only when the selection change was the only change that happened
  * in the document, and old selection is different then the new selection.
  * in the document, and old selection is different then the new selection.
  *
  *
- * @event engine.treeView.TreeView#selection
+ * @event engine.treeView.TreeView#selectionChange
  * @param {Object} data
  * @param {Object} data
  * @param {engine.treeView.Selection} data.oldSelection Old View selection which is
  * @param {engine.treeView.Selection} data.oldSelection Old View selection which is
  * {@link engine.treeView.TreeView#selection}.
  * {@link engine.treeView.TreeView#selection}.

+ 1 - 1
packages/ckeditor5-engine/tests/treeview/manual/inline-filler.js

@@ -21,7 +21,7 @@ treeView.addObserver( KeyObserver );
 setData( treeView,
 setData( treeView,
 	'<container:p><attribute:strong>foo</attribute:strong>[]<attribute:strong>bar</attribute:strong></container:p>' );
 	'<container:p><attribute:strong>foo</attribute:strong>[]<attribute:strong>bar</attribute:strong></container:p>' );
 
 
-treeView.on( 'selectionchange', ( evt, data ) => {
+treeView.on( 'selectionChange', ( evt, data ) => {
 	treeView.selection.setTo( data.newSelection );
 	treeView.selection.setTo( data.newSelection );
 } );
 } );
 
 

+ 1 - 1
packages/ckeditor5-engine/tests/treeview/manual/selectionobserver.js

@@ -22,7 +22,7 @@ setData( treeView,
 	'<container:p><attribute:b>foo</attribute:b>bar</container:p>' +
 	'<container:p><attribute:b>foo</attribute:b>bar</container:p>' +
 	'<container:p>bom</container:p>' );
 	'<container:p>bom</container:p>' );
 
 
-treeView.on( 'selectionchange', ( evt, data ) => {
+treeView.on( 'selectionChange', ( evt, data ) => {
 	console.log( data );
 	console.log( data );
 	treeView.selection.setTo( data.newSelection );
 	treeView.selection.setTo( data.newSelection );
 } );
 } );

+ 1 - 1
packages/ckeditor5-engine/tests/treeview/manual/x-index.js

@@ -24,7 +24,7 @@ setData( treeView,
 	'<container:p><attribute:strong></attribute:strong></container:p>' +
 	'<container:p><attribute:strong></attribute:strong></container:p>' +
 	'<container:p>bar</container:p>' );
 	'<container:p>bar</container:p>' );
 
 
-treeView.on( 'selectionchange', ( evt, data ) => {
+treeView.on( 'selectionChange', ( evt, data ) => {
 	const node = data.newSelection.getFirstPosition().parent;
 	const node = data.newSelection.getFirstPosition().parent;
 	console.log( node.name ? node.name : node._data );
 	console.log( node.name ? node.name : node._data );
 	treeView.selection.setTo( data.newSelection );
 	treeView.selection.setTo( data.newSelection );

+ 9 - 9
packages/ckeditor5-engine/tests/treeview/observer/selectionobserver.js

@@ -51,8 +51,8 @@ describe( 'SelectionObserver', () => {
 		listenter.stopListening();
 		listenter.stopListening();
 	} );
 	} );
 
 
-	it( 'should fire selectionchange when it is the only change', ( done ) => {
-		listenter.listenTo( treeView, 'selectionchange', ( evt, data ) => {
+	it( 'should fire selectionChange when it is the only change', ( done ) => {
+		listenter.listenTo( treeView, 'selectionChange', ( evt, data ) => {
 			expect( data ).to.have.property( 'domSelection' ).that.equals( document.getSelection() );
 			expect( data ).to.have.property( 'domSelection' ).that.equals( document.getSelection() );
 
 
 			expect( data ).to.have.property( 'oldSelection' ).that.is.instanceof( ViewSelection );
 			expect( data ).to.have.property( 'oldSelection' ).that.is.instanceof( ViewSelection );
@@ -79,16 +79,16 @@ describe( 'SelectionObserver', () => {
 		// Add second roots to ensure that listener is added once.
 		// Add second roots to ensure that listener is added once.
 		treeView.createRoot( document.getElementById( 'additional' ), 'additional' );
 		treeView.createRoot( document.getElementById( 'additional' ), 'additional' );
 
 
-		listenter.listenTo( treeView, 'selectionchange', () => {
+		listenter.listenTo( treeView, 'selectionChange', () => {
 			done();
 			done();
 		} );
 		} );
 
 
 		changeDomSelection();
 		changeDomSelection();
 	} );
 	} );
 
 
-	it( 'should not fire selectionchange on render', ( done ) => {
-		listenter.listenTo( treeView, 'selectionchange', () => {
-			throw 'selectionchange on render';
+	it( 'should not fire selectionChange on render', ( done ) => {
+		listenter.listenTo( treeView, 'selectionChange', () => {
+			throw 'selectionChange on render';
 		} );
 		} );
 
 
 		setTimeout( () => done(), 70 );
 		setTimeout( () => done(), 70 );
@@ -101,8 +101,8 @@ describe( 'SelectionObserver', () => {
 	it( 'should not fired if observer is disabled', ( done ) => {
 	it( 'should not fired if observer is disabled', ( done ) => {
 		treeView.getObserver( SelectionObserver ).disable();
 		treeView.getObserver( SelectionObserver ).disable();
 
 
-		listenter.listenTo( treeView, 'selectionchange', () => {
-			throw 'selectionchange on render';
+		listenter.listenTo( treeView, 'selectionChange', () => {
+			throw 'selectionChange on render';
 		} );
 		} );
 
 
 		setTimeout( () => done(), 70 );
 		setTimeout( () => done(), 70 );
@@ -114,7 +114,7 @@ describe( 'SelectionObserver', () => {
 		const viewBar = treeView.getRoot().getChild( 1 ).getChild( 0 );
 		const viewBar = treeView.getRoot().getChild( 1 ).getChild( 0 );
 		treeView.selection.addRange( ViewRange.createFromParentsAndOffsets( viewBar, 0, viewBar, 1 ) );
 		treeView.selection.addRange( ViewRange.createFromParentsAndOffsets( viewBar, 0, viewBar, 1 ) );
 
 
-		listenter.listenTo( treeView, 'selectionchange', () => {
+		listenter.listenTo( treeView, 'selectionChange', () => {
 			setTimeout( () => {
 			setTimeout( () => {
 				const domSelection = document.getSelection();
 				const domSelection = document.getSelection();