mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-28 22:30:40 -04:00
Merge branch 'develop' into privateSprite
This commit is contained in:
commit
b885402081
12 changed files with 204 additions and 40 deletions
|
@ -1,8 +1,11 @@
|
|||
const test = require('tap').test;
|
||||
const Music = require('../../src/extensions/scratch3_music/index.js');
|
||||
const runtime = Object.create(null);
|
||||
|
||||
const blocks = new Music(runtime);
|
||||
const fakeRuntime = {
|
||||
getTargetForStage: () => ({tempo: 60})
|
||||
};
|
||||
|
||||
const blocks = new Music(fakeRuntime);
|
||||
|
||||
const util = {
|
||||
stackFrame: Object.create(null),
|
||||
|
|
|
@ -105,7 +105,7 @@ test('renameSprite does not increment when renaming to the same name', t => {
|
|||
t.equal(vm.runtime.targets[0].sprite.name, 'foo');
|
||||
vm.renameSprite(target.id, 'foo');
|
||||
t.equal(vm.runtime.targets[0].sprite.name, 'foo');
|
||||
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
@ -276,6 +276,26 @@ test('duplicateSprite duplicates a sprite when given id is associated with known
|
|||
|
||||
});
|
||||
|
||||
test('duplicateSprite assigns duplicated sprite a fresh name', t => {
|
||||
const vm = new VirtualMachine();
|
||||
const spr = new Sprite(null, vm.runtime);
|
||||
spr.name = 'sprite1';
|
||||
const currTarget = spr.createClone();
|
||||
vm.editingTarget = currTarget;
|
||||
|
||||
vm.emitWorkspaceUpdate = () => null;
|
||||
|
||||
vm.runtime.targets = [currTarget];
|
||||
t.equal(vm.runtime.targets.length, 1);
|
||||
vm.duplicateSprite(currTarget.id).then(() => {
|
||||
t.equal(vm.runtime.targets.length, 2);
|
||||
t.equal(vm.runtime.targets[0].sprite.name, 'sprite1');
|
||||
t.equal(vm.runtime.targets[1].sprite.name, 'sprite2');
|
||||
t.end();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
test('emitWorkspaceUpdate', t => {
|
||||
const vm = new VirtualMachine();
|
||||
vm.runtime.targets = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue