本文整理匯總了TypeScript中@jupyterlab/docregistry/src.Context類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Context類的具體用法?TypeScript Context怎麽用?TypeScript Context使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Context類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should restore the value to the last checkpoint value', async () => {
context.model.fromString('bar');
await context.initialize(true);
const model = await context.createCheckpoint();
context.model.fromString('foo');
const id = model.id;
await context.save();
await context.restoreCheckpoint(id);
await context.revert();
expect(context.model.toString()).to.equal('bar');
});
示例2: waitForDialog
it('should save the document to a different path chosen by the user', async () => {
const initialize = context.initialize(true);
const newPath = UUID.uuid4() + '.txt';
const func = async () => {
await initialize;
await waitForDialog();
const dialog = document.body.getElementsByClassName('jp-Dialog')[0];
const input = dialog.getElementsByTagName('input')[0];
input.value = newPath;
await acceptDialog();
};
const promise = func();
await initialize;
await context.saveAs();
expect(context.path).to.equal(newPath);
await promise;
});