Merge pull request #1226 from towerofnix/costumename-vm

Implement "costume name" block
This commit is contained in:
kchadha 2018-06-12 18:50:46 -04:00 committed by GitHub
commit b4891bb0d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 2 deletions

View file

@ -954,6 +954,12 @@ const parseBlock = function (sb2block, addBroadcastMsg, getVariableId, extension
value: 'number'
};
break;
case 'costumeName':
activeBlock.fields.NUMBER_NAME = {
name: 'NUMBER_NAME',
value: 'name'
};
break;
}
// Special cases to generate mutations.

View file

@ -428,6 +428,11 @@ const specMap = {
argMap: [
]
},
'costumeName': {
opcode: 'looks_costumenumbername',
argMap: [
]
},
'sceneName': {
opcode: 'looks_backdropnumbername',
argMap: [

View file

@ -34,8 +34,8 @@ test('getCostumeNumberName returns 1-indexed costume number', t => {
test('getCostumeNumberName can return costume name', t => {
util.target.currentCostume = 0; // This is 0-indexed.
const args = {NUMBER_NAME: 'name'};
const number = blocks.getCostumeNumberName(args, util);
t.strictEqual(number, 'first name');
const name = blocks.getCostumeNumberName(args, util);
t.strictEqual(name, 'first name');
t.end();
});