Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

T/38 Make remove on image abortion permanent #39

Merged
merged 2 commits into from
Jul 6, 2017
Merged

T/38 Make remove on image abortion permanent #39

merged 2 commits into from
Jul 6, 2017

Conversation

scofalik
Copy link
Contributor

@scofalik scofalik commented Jun 24, 2017

Suggested merge commit message (convention)

Fix: When image upload is aborted, now the "image placeholder" element is permanently removed so it is not reinserted on undo. Closes ckeditor/ckeditor5#2811.


Additional information

Additionally, uploadStatus attribute does not change on undo/redo, although this is less important, as image element is in graveyard anyway. Still, this means that there are less deltas created and applied so there are less objects in engine.model.History and it is easier to debug.

@scofalik
Copy link
Contributor Author

@@ -234,4 +235,48 @@ describe( 'ImageUploadEngine', () => {
expect( loader.status ).to.equal( 'aborted' );
sinon.assert.calledOnce( abortSpy );
} );

it( 'image should be permanently removed if it is removed by user during upload', done => {
Copy link
Contributor Author

@scofalik scofalik Jun 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I hate this test and how you need to use three consecutive document#event:changesDone to test something "just after the image placeholder is removed".

It's hard to test it because the image is removed in a Promise's catch callback and the Promise is not returned anywhere. This test (and a test above that was already there) are very prone to fail in future because of theoretically unrelated changes.

Anyway, I've spent two hours trying to write this test in a better way and I haven't came up with anything working.

@scofalik scofalik changed the title T/38 T/38 Make remove on image abortion permanent Jun 26, 2017
@Reinmar Reinmar merged commit aff6382 into master Jul 6, 2017
@Reinmar Reinmar deleted the t/38 branch July 6, 2017 16:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix integration with undo.
2 participants