Browse Source

Merge pull request #344 from ckeditor/i/6326

Tests: Added a missing test case for image load observer. Closes ckeditor/ckeditor5#6326.
Piotrek Koszuliński 5 years ago
parent
commit
d4ebc9afaf
1 changed files with 16 additions and 0 deletions
  1. 16 0
      packages/ckeditor5-image/tests/image/imageloadobserver.js

+ 16 - 0
packages/ckeditor5-image/tests/image/imageloadobserver.js

@@ -92,6 +92,22 @@ describe( 'ImageLoadObserver', () => {
 		sinon.assert.notCalled( spy );
 	} );
 
+	it( 'should not fire `loadImage` event for non-image elements', () => {
+		const spy = sinon.spy();
+
+		viewDocument.on( 'imageLoaded', spy );
+
+		setData( view, '<p>foo</p>' );
+
+		sinon.assert.notCalled( spy );
+
+		const img = domRoot.querySelector( 'p' );
+
+		img.dispatchEvent( new Event( 'load' ) );
+
+		sinon.assert.notCalled( spy );
+	} );
+
 	it( 'should do nothing with an image when changes are in the other parent', () => {
 		setData(
 			view,