fix code review comments

This commit is contained in:
picklesrus 2018-11-21 11:08:22 -05:00
parent f214d3a191
commit 4a542b455d
3 changed files with 8 additions and 8 deletions

View file

@ -313,7 +313,7 @@ class Scratch3SensingBlocks {
}
}
// Local variables (not lists).
// Target variables.
const varName = args.PROPERTY;
const variable = attrTarget.lookupVariableByNameAndType(varName, '', true);
if (variable) {

View file

@ -2181,7 +2181,7 @@ class Runtime extends EventEmitter {
* Emit an event that indicate that the blocks on the workspace need updating.
*/
requestBlocksUpdate () {
this.emit(Runtime.BLOCK_NEED_UPDATE);
this.emit(Runtime.BLOCKS_NEED_UPDATE);
}
/**

View file

@ -234,12 +234,12 @@ test('get attribute of sprite variable', t => {
const sensing = new Sensing(rt);
const s = new Sprite();
const target = new RenderedTarget(s, rt);
const thing = {
const variable = {
name: 'cars',
value: 'trucks'
};
rt.getSpriteTargetByName = () => target;
target.lookupVariableByNameAndType = () => thing;
target.lookupVariableByNameAndType = () => variable;
t.equal(sensing.getAttributeOf({PROPERTY: 'cars'}), 'trucks');
t.end();
@ -248,10 +248,10 @@ test('get attribute of variable that does not exist', t => {
const rt = new Runtime();
const sensing = new Sensing(rt);
const s = new Sprite();
const stage = new RenderedTarget(s, rt);
rt.getTargetForStage = () => stage;
stage.lookupVariableByNameAndType = () => null;
t.equal(sensing.getAttributeOf({PROPERTY: 'stage'}), 0);
const target = new RenderedTarget(s, rt);
rt.getTargetForStage = () => target;
target.lookupVariableByNameAndType = () => null;
t.equal(sensing.getAttributeOf({PROPERTY: 'variableThatDoesNotExist'}), 0);
t.end();
});