本文整理匯總了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;
});