mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 23:12:24 -05:00
Merge pull request #1163 from paulkaplan/username-stub
Add logged out version of username block
This commit is contained in:
commit
02041c8218
2 changed files with 14 additions and 0 deletions
|
@ -68,6 +68,7 @@ class Scratch3SensingBlocks {
|
||||||
sensing_loud: this.isLoud,
|
sensing_loud: this.isLoud,
|
||||||
sensing_askandwait: this.askAndWait,
|
sensing_askandwait: this.askAndWait,
|
||||||
sensing_answer: this.getAnswer,
|
sensing_answer: this.getAnswer,
|
||||||
|
sensing_username: this.getUsername,
|
||||||
sensing_userid: () => {} // legacy no-op block
|
sensing_userid: () => {} // legacy no-op block
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -315,6 +316,11 @@ class Scratch3SensingBlocks {
|
||||||
// Otherwise, 0
|
// Otherwise, 0
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getUsername () {
|
||||||
|
// Logged out users get empty string. Return that for now.
|
||||||
|
return '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Scratch3SensingBlocks;
|
module.exports = Scratch3SensingBlocks;
|
||||||
|
|
|
@ -143,3 +143,11 @@ test('loud? boolean', t => {
|
||||||
|
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('username block', t => {
|
||||||
|
const rt = new Runtime();
|
||||||
|
const sensing = new Sensing(rt);
|
||||||
|
|
||||||
|
t.equal(sensing.getUsername(), '');
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in a new issue