mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-10 15:02:06 -05:00
Fixing linter errors.
This commit is contained in:
parent
7fae93f6e6
commit
c31fff8c4c
2 changed files with 9 additions and 9 deletions
|
@ -509,6 +509,8 @@ class VirtualMachine extends EventEmitter {
|
||||||
/**
|
/**
|
||||||
* Duplicate a sprite.
|
* Duplicate a sprite.
|
||||||
* @param {string} targetId ID of a target whose sprite to duplicate.
|
* @param {string} targetId ID of a target whose sprite to duplicate.
|
||||||
|
* @returns {Promise} Promise that resolves when duplicated target has
|
||||||
|
* been added to the runtime.
|
||||||
*/
|
*/
|
||||||
duplicateSprite (targetId) {
|
duplicateSprite (targetId) {
|
||||||
const target = this.runtime.getTargetById(targetId);
|
const target = this.runtime.getTargetById(targetId);
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
const test = require('tap').test;
|
const test = require('tap').test;
|
||||||
const VirtualMachine = require('../../src/virtual-machine.js');
|
const VirtualMachine = require('../../src/virtual-machine.js');
|
||||||
const Target = require('../../src/engine/target.js');
|
|
||||||
const Sprite = require('../../src/sprites/sprite.js');
|
const Sprite = require('../../src/sprites/sprite.js');
|
||||||
const RenderedTarget = require('../../src/sprites/rendered-target');
|
|
||||||
|
|
||||||
test('renameSprite throws when there is no sprite with that id', t => {
|
test('renameSprite throws when there is no sprite with that id', t => {
|
||||||
const vm = new VirtualMachine();
|
const vm = new VirtualMachine();
|
||||||
|
@ -121,7 +119,7 @@ test('deleteSprite throws when used on a non-sprite target', t => {
|
||||||
}];
|
}];
|
||||||
t.throws(
|
t.throws(
|
||||||
(() => vm.deleteSprite('id')),
|
(() => vm.deleteSprite('id')),
|
||||||
new Error ('Cannot delete non-sprite targets.')
|
new Error('Cannot delete non-sprite targets.')
|
||||||
);
|
);
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
@ -135,7 +133,7 @@ test('deleteSprite throws when there is no sprite for the given target', t => {
|
||||||
}];
|
}];
|
||||||
t.throws(
|
t.throws(
|
||||||
(() => vm.deleteSprite('id')),
|
(() => vm.deleteSprite('id')),
|
||||||
new Error ('No sprite associated with this target.')
|
new Error('No sprite associated with this target.')
|
||||||
);
|
);
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
@ -151,7 +149,7 @@ test('deleteSprite throws when there is no target with given id', t => {
|
||||||
}];
|
}];
|
||||||
t.throws(
|
t.throws(
|
||||||
(() => vm.deleteSprite('id1')),
|
(() => vm.deleteSprite('id1')),
|
||||||
new Error ('No target with the provided id.')
|
new Error('No target with the provided id.')
|
||||||
);
|
);
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
@ -169,7 +167,8 @@ test('deleteSprite deletes a sprite when given id is associated with a known spr
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('deleteSprite sets editing target as null when sprite being deleted is current editing target, and the only target in the runtime', t => {
|
// eslint-disable-next-line max-len
|
||||||
|
test('deleteSprite sets editing target as null when given sprite is current editing target, and the only target in the runtime', t => {
|
||||||
const vm = new VirtualMachine();
|
const vm = new VirtualMachine();
|
||||||
const spr = new Sprite(null, vm.runtime);
|
const spr = new Sprite(null, vm.runtime);
|
||||||
const currTarget = spr.createClone();
|
const currTarget = spr.createClone();
|
||||||
|
@ -184,6 +183,7 @@ test('deleteSprite sets editing target as null when sprite being deleted is curr
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
test('deleteSprite updates editingTarget when sprite being deleted is current editing target, and there is another target in the runtime', t => {
|
test('deleteSprite updates editingTarget when sprite being deleted is current editing target, and there is another target in the runtime', t => {
|
||||||
const vm = new VirtualMachine();
|
const vm = new VirtualMachine();
|
||||||
const spr1 = new Sprite(null, vm.runtime);
|
const spr1 = new Sprite(null, vm.runtime);
|
||||||
|
@ -218,8 +218,6 @@ test('deleteSprite updates editingTarget when sprite being deleted is current ed
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
test('duplicateSprite throws when there is no target with given id', t => {
|
test('duplicateSprite throws when there is no target with given id', t => {
|
||||||
const vm = new VirtualMachine();
|
const vm = new VirtualMachine();
|
||||||
vm.runtime.targets = [{
|
vm.runtime.targets = [{
|
||||||
|
@ -258,7 +256,7 @@ test('duplicateSprite throws when there is no sprite for the given target', t =>
|
||||||
}];
|
}];
|
||||||
t.throws(
|
t.throws(
|
||||||
(() => vm.duplicateSprite('id')),
|
(() => vm.duplicateSprite('id')),
|
||||||
new Error ('No sprite associated with this target.')
|
new Error('No sprite associated with this target.')
|
||||||
);
|
);
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue