Allow deleting the last sound

This commit is contained in:
Paul Kaplan 2017-05-18 13:29:44 -04:00
parent a608ca4fed
commit 30a0c0d251
2 changed files with 2 additions and 3 deletions

View file

@ -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));

View file

@ -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();
});