mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-24 08:30:31 -05:00
Added test
This commit is contained in:
parent
6055823f20
commit
dd82bf6dc8
1 changed files with 17 additions and 0 deletions
|
@ -153,6 +153,23 @@ test('ask and answer with a visible target', t => {
|
||||||
s.askAndWait({QUESTION: expectedQuestion}, util);
|
s.askAndWait({QUESTION: expectedQuestion}, util);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('answer gets reset when runtime is disposed', t => {
|
||||||
|
const rt = new Runtime();
|
||||||
|
const s = new Sensing(rt);
|
||||||
|
const util = {target: {visible: false}};
|
||||||
|
const expectedAnswer = 'the answer';
|
||||||
|
|
||||||
|
rt.addListener('QUESTION', () => rt.emit('ANSWER', expectedAnswer));
|
||||||
|
const promise = s.askAndWait({QUESTION: ''}, util);
|
||||||
|
|
||||||
|
promise.then(() => t.strictEqual(s.getAnswer(), expectedAnswer))
|
||||||
|
.then(() => rt.dispose())
|
||||||
|
.then(() => {
|
||||||
|
t.strictEqual(s.getAnswer(), '');
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test('set drag mode', t => {
|
test('set drag mode', t => {
|
||||||
const runtime = new Runtime();
|
const runtime = new Runtime();
|
||||||
runtime.requestTargetsUpdate = () => {}; // noop for testing
|
runtime.requestTargetsUpdate = () => {}; // noop for testing
|
||||||
|
|
Loading…
Reference in a new issue