Initial commit of 001code-html Scratch frontend project.
Includes scratch-gui, scratch-vm, scratch-blocks, scratch-render, scratch-l10n, and deployment config. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
63
scratch-vm/test/unit/tw_extension_monitors.js
Normal file
63
scratch-vm/test/unit/tw_extension_monitors.js
Normal file
@@ -0,0 +1,63 @@
|
||||
const {test} = require('tap');
|
||||
const Runtime = require('../../src/engine/runtime');
|
||||
const BlockType = require('../../src/extension-support/block-type');
|
||||
const ArgumentType = require('../../src/extension-support/argument-type');
|
||||
|
||||
test('Boolean blocks can be monitors', t => {
|
||||
const rt = new Runtime();
|
||||
rt._registerExtensionPrimitives({
|
||||
id: 'testextension',
|
||||
blocks: [
|
||||
{
|
||||
blockType: BlockType.REPORTER,
|
||||
opcode: 'reporter1',
|
||||
text: 'reporter 1'
|
||||
},
|
||||
{
|
||||
blockType: BlockType.REPORTER,
|
||||
opcode: 'reporter2',
|
||||
text: 'reporter 2',
|
||||
disableMonitor: true
|
||||
},
|
||||
{
|
||||
blockType: BlockType.REPORTER,
|
||||
opcode: 'reporter3',
|
||||
text: 'reporter 3 [INPUT]',
|
||||
arguments: {
|
||||
type: ArgumentType.STRING,
|
||||
defaultValue: ''
|
||||
}
|
||||
},
|
||||
{
|
||||
blockType: BlockType.BOOLEAN,
|
||||
opcode: 'boolean1',
|
||||
text: 'boolean 1'
|
||||
},
|
||||
{
|
||||
blockType: BlockType.BOOLEAN,
|
||||
opcode: 'boolean2',
|
||||
text: 'boolean 2',
|
||||
disableMonitor: true
|
||||
},
|
||||
{
|
||||
blockType: BlockType.BOOLEAN,
|
||||
opcode: 'boolean3',
|
||||
text: 'boolean 3 [INPUT]',
|
||||
arguments: {
|
||||
type: ArgumentType.STRING,
|
||||
defaultValue: ''
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const json = rt.getBlocksJSON();
|
||||
t.equal(json.length, 6);
|
||||
t.equal(json[0].checkboxInFlyout, true);
|
||||
t.equal(json[1].checkboxInFlyout, undefined);
|
||||
t.equal(json[2].checkboxInFlyout, undefined);
|
||||
t.equal(json[3].checkboxInFlyout, true);
|
||||
t.equal(json[4].checkboxInFlyout, undefined);
|
||||
t.equal(json[5].checkboxInFlyout, undefined);
|
||||
t.end();
|
||||
});
|
||||
Reference in New Issue
Block a user