mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-30 00:02:51 -04:00
round numbers but break tests
This commit is contained in:
parent
372c50ef69
commit
f8dced53dc
2 changed files with 14 additions and 0 deletions
|
@ -251,6 +251,10 @@ class Scratch3LooksBlocks {
|
||||||
|
|
||||||
say (args, util) {
|
say (args, util) {
|
||||||
// @TODO in 2.0 calling say/think resets the right/left bias of the bubble
|
// @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));
|
this._updateBubble(util.target, 'say', String(args.MESSAGE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,3 +50,13 @@ test('getBackdropNumberName can return costume name', t => {
|
||||||
t.strictEqual(number, 'third name');
|
t.strictEqual(number, 'third name');
|
||||||
t.end();
|
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();
|
||||||
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue