From 2a90e5868d7911f0bc85bfef16216d2409aaa1d5 Mon Sep 17 00:00:00 2001 From: Eric Rosenbaum Date: Thu, 5 Apr 2018 15:01:52 -0400 Subject: [PATCH] Fix runtime scope and unit test --- src/extensions/scratch3_music/index.js | 2 +- test/unit/extension_music.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/extensions/scratch3_music/index.js b/src/extensions/scratch3_music/index.js index 3a5552c45..03f175c75 100644 --- a/src/extensions/scratch3_music/index.js +++ b/src/extensions/scratch3_music/index.js @@ -76,7 +76,7 @@ class Scratch3MusicBlocks { this._loadAllSounds(); this._onTargetCreated = this._onTargetCreated.bind(this); - runtime.on('targetWasCreated', this._onTargetCreated); + this.runtime.on('targetWasCreated', this._onTargetCreated); } /** diff --git a/test/unit/extension_music.js b/test/unit/extension_music.js index ad35b29a8..d17069d40 100644 --- a/test/unit/extension_music.js +++ b/test/unit/extension_music.js @@ -2,7 +2,8 @@ const test = require('tap').test; const Music = require('../../src/extensions/scratch3_music/index.js'); const fakeRuntime = { - getTargetForStage: () => ({tempo: 60}) + getTargetForStage: () => ({tempo: 60}), + on: () => {} // Stub out listener methods used in constructor. }; const blocks = new Music(fakeRuntime);