re-emit the PROJECT_START event publicly, add unit test

This commit is contained in:
Paul Kaplan 2018-12-06 11:47:09 -05:00
parent 23d9c21a0e
commit 56c062eee3
2 changed files with 14 additions and 0 deletions

View file

@ -78,6 +78,9 @@ class VirtualMachine extends EventEmitter {
this.runtime.on(Runtime.BLOCK_GLOW_OFF, glowData => {
this.emit(Runtime.BLOCK_GLOW_OFF, glowData);
});
this.runtime.on(Runtime.PROJECT_START, () => {
this.emit(Runtime.PROJECT_START);
});
this.runtime.on(Runtime.PROJECT_RUN_START, () => {
this.emit(Runtime.PROJECT_RUN_START);
});

View file

@ -983,6 +983,17 @@ test('Starting the VM emits an event', t => {
t.end();
});
test('vm.greenFlag() emits a PROJECT_START event', t => {
let greenFlagged = false;
const vm = new VirtualMachine();
vm.addListener('PROJECT_START', () => {
greenFlagged = true;
});
vm.greenFlag();
t.equal(greenFlagged, true);
t.end();
});
test('toJSON encodes Infinity/NaN as 0, not null', t => {
const vm = new VirtualMachine();
const runtime = vm.runtime;