diff --git a/src/blocks/scratch3_looks.js b/src/blocks/scratch3_looks.js index e173ca04..e011858a 100644 --- a/src/blocks/scratch3_looks.js +++ b/src/blocks/scratch3_looks.js @@ -251,6 +251,10 @@ class Scratch3LooksBlocks { say (args, util) { // @TODO in 2.0 calling say/think resets the right/left bias of the bubble + let message = args.MESSAGE; + if (typeof message === 'number') { + message = message.toFixed(2); + } this._updateBubble(util.target, 'say', String(args.MESSAGE)); } diff --git a/test/unit/blocks_looks.js b/test/unit/blocks_looks.js index 1506d7f8..647aeb17 100644 --- a/test/unit/blocks_looks.js +++ b/test/unit/blocks_looks.js @@ -50,3 +50,13 @@ test('getBackdropNumberName can return costume name', t => { t.strictEqual(number, 'third name'); t.end(); }); + +test('numbers should be rounded to two decimals in say', t => { + const args = {MESSAGE: 3.14159}; + const sayString = blocks.say(args, util); + // This breaks becuase it is not returned, + // instead this calls this._updateBubble(util.target, 'say', String(args.MESSAGE)); + // I'm not familiar + t.strictEqual(sayString, '3.14'); + t.end(); +});