本文整理汇总了TypeScript中@jupyterlab/testutils.waitForDialog函数的典型用法代码示例。如果您正苦于以下问题:TypeScript waitForDialog函数的具体用法?TypeScript waitForDialog怎么用?TypeScript waitForDialog使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了waitForDialog函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: async
const func = async () => {
await waitForDialog();
const dialog = document.body.getElementsByClassName('jp-Dialog')[0];
const input = dialog.getElementsByTagName('input')[0];
input.value = newPath;
await acceptDialog(); // Accept rename dialog
await dismissDialog(); // Reject conflict dialog
};
示例2: async
const func = async () => {
await waitForDialog();
const dialog = document.body.getElementsByClassName('jp-Dialog')[0];
const input = dialog.getElementsByTagName('input')[0];
input.value = newPath;
await acceptDialog();
await acceptDialog();
};
示例3: it
it('should revert to the file on disk', async () => {
const delegate = new PromiseDelegate();
const revert = () => {
const dialog = document.body.getElementsByClassName('jp-Dialog')[0];
const buttons = dialog.getElementsByTagName('button');
for (let i = 0; i < buttons.length; i++) {
if (buttons[i].textContent === 'REVERT') {
buttons[i].click();
return;
}
}
};
// Lower the duration multiplier.
(handler as any)._multiplier = 1;
await context.initialize(true);
context.model.fromString('foo');
context.fileChanged.connect(() => {
expect(context.model.toString()).to.equal('bar');
delegate.resolve(undefined);
});
// The server has a one second resolution for saves.
setTimeout(async () => {
await manager.contents.save(context.path, {
type: factory.contentType,
format: factory.fileFormat,
content: 'bar'
});
handler.saveInterval = 1;
handler.start();
context.model.fromString('baz');
}, 1500);
// Extend the timeout to wait for the dialog because of the setTimeout.
await waitForDialog(document.body, 3000);
revert();
await delegate.promise;
});