Skip to content

Conversation

@kchadha
Copy link
Contributor

@kchadha kchadha commented Aug 20, 2018

Resolves

Towards restoring a deleted sound.

Proposed Changes

Deleting a sound returns a function to restore the deleted sound.

Reason for Changes

Restore sound feature.

Test Coverage

Added new unit test for vm.deleteSound and updated a unit test for rendered-target.deleteSound.

Related PRs

scratchfoundation/scratch-gui#2935

/**
* Delete a sound from the current editing target.
* @param {int} soundIndex - the index of the sound to be removed.
* @return {?Function} A function to restore the sound that was deleted,

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

return null;
}
// Delete the sound at the given index
const deletedSound = this.sprite.sounds.splice(index, 1)[0];

This comment was marked as abuse.

This comment was marked as abuse.

Copy link
Contributor

@rschamp rschamp left a comment

Choose a reason for hiding this comment

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

Looks good!

const firstDeleted = a.deleteSound(0);
t.deepEqual(a.sprite.sounds, [o2, o3]);
t.type(firstDeleted, 'object');
t.equals(firstDeleted.id, 1);

This comment was marked as abuse.

This comment was marked as abuse.

return null;
}
// Delete the sound at the given index
const deletedSound = this.sprite.sounds.splice(index, 1)[0];

This comment was marked as abuse.

/**
* Delete a sound from the current editing target.
* @param {int} soundIndex - the index of the sound to be removed.
* @return {?Function} A function to restore the sound that was deleted,

This comment was marked as abuse.

@kchadha kchadha merged commit 6f9da87 into scratchfoundation:develop Aug 21, 2018
@kchadha kchadha deleted the restore-sound branch August 21, 2018 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants