Use new Scratch-specific callback keys for extension buttons

This commit is contained in:
Christopher Willis-Ford 2019-04-02 22:44:23 -07:00
parent d59c6a0b73
commit 9eef05a7c5
2 changed files with 3 additions and 3 deletions

View file

@ -1166,7 +1166,7 @@ class Runtime extends EventEmitter {
*/
_convertButtonForScratchBlocks (buttonInfo) {
// for now we only support these pre-defined callbacks handled in scratch-blocks
const supportedCallbackKeys = ['CREATE_LIST', 'CREATE_PROCEDURE', 'CREATE_VARIABLE'];
const supportedCallbackKeys = ['MAKE_A_LIST', 'MAKE_A_PROCEDURE', 'MAKE_A_VARIABLE'];
if (supportedCallbackKeys.indexOf(buttonInfo.func) < 0) {
log.error(`Custom button callbacks not supported yet: ${buttonInfo.func}`);
}

View file

@ -13,7 +13,7 @@ const testExtensionInfo = {
name: 'fake test extension',
blocks: [
{
func: 'CREATE_VARIABLE',
func: 'MAKE_A_VARIABLE',
blockType: BlockType.BUTTON,
text: 'this is a button'
},
@ -65,7 +65,7 @@ const testExtensionInfo = {
const testButton = function (t, button) {
t.same(button.json, null); // should be null or undefined
t.equal(button.xml, '<button text="this is a button" callbackKey="CREATE_VARIABLE"></button>');
t.equal(button.xml, '<button text="this is a button" callbackKey="MAKE_A_VARIABLE"></button>');
};
const testReporter = function (t, reporter) {