From 4a542b455da53ed0868fa57753d64f57d0d6f1e7 Mon Sep 17 00:00:00 2001 From: picklesrus Date: Wed, 21 Nov 2018 11:08:22 -0500 Subject: [PATCH] fix code review comments --- src/blocks/scratch3_sensing.js | 2 +- src/engine/runtime.js | 2 +- test/unit/blocks_sensing.js | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/blocks/scratch3_sensing.js b/src/blocks/scratch3_sensing.js index 9f3ed7420..ee4a009b4 100644 --- a/src/blocks/scratch3_sensing.js +++ b/src/blocks/scratch3_sensing.js @@ -313,7 +313,7 @@ class Scratch3SensingBlocks { } } - // Local variables (not lists). + // Target variables. const varName = args.PROPERTY; const variable = attrTarget.lookupVariableByNameAndType(varName, '', true); if (variable) { diff --git a/src/engine/runtime.js b/src/engine/runtime.js index f59b5dd59..b53014c19 100644 --- a/src/engine/runtime.js +++ b/src/engine/runtime.js @@ -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); } /** diff --git a/test/unit/blocks_sensing.js b/test/unit/blocks_sensing.js index d60b8fa68..bb08cabb4 100644 --- a/test/unit/blocks_sensing.js +++ b/test/unit/blocks_sensing.js @@ -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(); });