mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-14 15:28:50 -04:00
Bugfix for scratch-gui issue #994, where executing a broadcast block from the flyout was creating a conflicting variable, causing a fatal error.
This commit is contained in:
parent
0722708004
commit
34b0aff637
4 changed files with 48 additions and 48 deletions
test/unit
|
@ -174,20 +174,7 @@ test('lookupOrCreateList returns list if one with given id exists', t => {
|
|||
t.end();
|
||||
});
|
||||
|
||||
test('lookupOrCreateBroadcastMsg creates a var if one does not exist', t => {
|
||||
const target = new Target();
|
||||
const variables = target.variables;
|
||||
|
||||
t.equal(Object.keys(variables).length, 0);
|
||||
const broadcastVar = target.lookupOrCreateBroadcastMsg('foo', 'bar');
|
||||
t.equal(Object.keys(variables).length, 1);
|
||||
t.equal(broadcastVar.id, 'foo');
|
||||
t.equal(broadcastVar.name, 'bar');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('lookupOrCreateBroadcastMsg returns the var with given id if exists', t => {
|
||||
test('lookupBroadcastMsg returns the var with given id if exists', t => {
|
||||
const target = new Target();
|
||||
const variables = target.variables;
|
||||
|
||||
|
@ -195,7 +182,7 @@ test('lookupOrCreateBroadcastMsg returns the var with given id if exists', t =>
|
|||
target.createVariable('foo', 'bar', Variable.BROADCAST_MESSAGE_TYPE);
|
||||
t.equal(Object.keys(variables).length, 1);
|
||||
|
||||
const broadcastMsg = target.lookupOrCreateBroadcastMsg('foo', 'bar');
|
||||
const broadcastMsg = target.lookupBroadcastMsg('foo', 'bar');
|
||||
t.equal(Object.keys(variables).length, 1);
|
||||
t.equal(broadcastMsg.id, 'foo');
|
||||
t.equal(broadcastMsg.name, 'bar');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue