-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Restore sound #1503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore sound #1503
Conversation
| /** | ||
| * 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.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
| 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.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
rschamp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
test/unit/sprites_rendered-target.js
Outdated
| 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.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
| 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.
Sorry, something went wrong.
| /** | ||
| * 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.
Sorry, something went wrong.
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