|
@@ -3,7 +3,7 @@
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
-/* globals window, document */
|
|
|
|
|
|
|
+/* globals window, document, KeyboardEvent */
|
|
|
|
|
|
|
|
import DeleteObserver from '../src/deleteobserver';
|
|
import DeleteObserver from '../src/deleteobserver';
|
|
|
import View from '@ckeditor/ckeditor5-engine/src/view/view';
|
|
import View from '@ckeditor/ckeditor5-engine/src/view/view';
|
|
@@ -252,6 +252,33 @@ describe( 'DeleteObserver', () => {
|
|
|
|
|
|
|
|
sinon.assert.calledOnce( keydownSpy );
|
|
sinon.assert.calledOnce( keydownSpy );
|
|
|
} );
|
|
} );
|
|
|
|
|
+
|
|
|
|
|
+ it( 'should not be fired for ignored target', () => {
|
|
|
|
|
+ const div = document.createElement( 'div' );
|
|
|
|
|
+ const input = document.createElement( 'input' );
|
|
|
|
|
+
|
|
|
|
|
+ div.setAttribute( 'data-cke-ignore-events', 'true' );
|
|
|
|
|
+ div.appendChild( input );
|
|
|
|
|
+ document.body.appendChild( div );
|
|
|
|
|
+
|
|
|
|
|
+ const view = new View();
|
|
|
|
|
+ const viewDocument = view.document;
|
|
|
|
|
+
|
|
|
|
|
+ createViewRoot( viewDocument );
|
|
|
|
|
+
|
|
|
|
|
+ view.addObserver( DeleteObserver );
|
|
|
|
|
+ view.attachDomRoot( div );
|
|
|
|
|
+
|
|
|
|
|
+ const spy = sinon.spy();
|
|
|
|
|
+
|
|
|
|
|
+ viewDocument.on( 'delete', spy );
|
|
|
|
|
+ input.dispatchEvent( new KeyboardEvent( 'keydown', { bubbles: true, keyCode: getCode( 'delete' ) } ) );
|
|
|
|
|
+
|
|
|
|
|
+ sinon.assert.notCalled( spy );
|
|
|
|
|
+
|
|
|
|
|
+ view.destroy();
|
|
|
|
|
+ div.remove();
|
|
|
|
|
+ } );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
function getDomEvent() {
|
|
function getDomEvent() {
|