Merge pull request #1163 from paulkaplan/username-stub

Add logged out version of username block
This commit is contained in:
Paul Kaplan 2018-05-24 13:29:47 -04:00 committed by GitHub
commit 02041c8218
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View file

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

View file

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