提交 5d8bd62e 编写于 作者: J Johannes Rieken

add API test for onDidExecuteCommand, #1431

上级 6a25cfa6
......@@ -113,4 +113,31 @@ suite('commands namespace tests', () => {
return Promise.all([a, b, c, d]);
});
});
\ No newline at end of file
test('onDidExecuteCommand', async function () {
let args: any[];
let d1 = commands.registerCommand('t1', function () {
args = [...arguments];
});
const p = new Promise((resolve, reject) => {
let d2 = commands.onDidExecuteCommand(event => {
d2.dispose();
d1.dispose();
try {
assert.equal(event.command, 't1');
assert.deepEqual(args, event.arguments);
resolve();
} catch (e) {
reject(e);
}
});
});
await commands.executeCommand('t1', { foo: 1 });
await p;
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册