round numbers but break tests

This commit is contained in:
Luke Schlangen 2018-01-31 08:23:08 -06:00
parent 372c50ef69
commit f8dced53dc
2 changed files with 14 additions and 0 deletions

View file

@ -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));
}

View file

@ -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();
});