mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 06:23:37 -05:00
Allow deleting the last sound
This commit is contained in:
parent
a608ca4fed
commit
30a0c0d251
2 changed files with 2 additions and 3 deletions
|
@ -415,7 +415,6 @@ class RenderedTarget extends Target {
|
|||
* @param {number} index Sound index to be deleted
|
||||
*/
|
||||
deleteSound (index) {
|
||||
if (this.sprite.sounds.length === 1) return;
|
||||
this.sprite.sounds = this.sprite.sounds
|
||||
.slice(0, index)
|
||||
.concat(this.sprite.sounds.slice(index + 1));
|
||||
|
|
|
@ -155,10 +155,10 @@ test('deleteSound', t => {
|
|||
a.deleteSound(0);
|
||||
t.deepEqual(a.sprite.sounds, [o2, o3]);
|
||||
|
||||
// Refuses to delete only sound
|
||||
// Allows deleting the only sound
|
||||
a.sprite.sounds = [o1];
|
||||
a.deleteSound(0);
|
||||
t.deepEqual(a.sprite.sounds, [o1]);
|
||||
t.deepEqual(a.sprite.sounds, []);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue