Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should resolve after the reveal and context ready promises', async () => {
const x = Object.create(null);
const reveal = sleep(300, x);
const contextReady = Promise.all([context.ready, x]);
const widget = new DocumentWidget({ context, content, reveal });
expect(widget.isRevealed).to.equal(false);
// Our promise should resolve before the widget reveal promise.
expect(await Promise.race([widget.revealed, reveal])).to.equal(x);
// The context ready promise should also resolve first.
void context.initialize(true);
expect(
await Promise.race([widget.revealed, contextReady])
).to.deep.equal([undefined, x]);
// The widget.revealed promise should finally resolve.
expect(await widget.revealed).to.be.undefined;
});
});
it('should add the document class', () => {
const content = new Widget();
const widget = new DocumentWidget({ content, context });
manager.adoptWidget(context, widget);
expect(widget.hasClass('jp-Document')).to.equal(true);
});
it('should add the document class', () => {
const content = new Widget();
const widget = new DocumentWidget({ content, context });
manager.adoptWidget(context, widget);
expect(widget.hasClass('jp-Document')).to.equal(true);
});
it('should be called for a message to a tracked widget', () => {
const content = new Widget();
const widget = new DocumentWidget({ content, context });
manager.adoptWidget(context, widget);
MessageLoop.sendMessage(widget, new Message('foo'));
expect(manager.methods).to.contain('messageHook');
});
const setup = () => {
context = createFileContext(undefined, manager);
content = new Widget();
widget = new DocumentWidget({ context, content });
};
protected createNewWidget(
context: DocumentRegistry.Context
): IDocumentWidget {
const content = new Widget();
const widget = new DocumentWidget({ content, context });
widget.addClass('WidgetFactory');
return widget;
}
}
protected createNewWidget(
context: DocumentRegistry.Context
): IDocumentWidget {
const content = new Widget();
const widget = new DocumentWidget({ content, context });
widget.addClass('WidgetFactory');
return widget;
}
}
protected createNewWidget(
context: DocumentRegistry.Context
): IDocumentWidget {
const content = new Widget();
const widget = new DocumentWidget({ content, context });
widget.addClass('WidgetFactory');
return widget;
}
}
protected createNewWidget(
context: DocumentRegistry.Context
): IDocumentWidget {
const content = new Widget();
const widget = new DocumentWidget({ content, context });
widget.addClass('WidgetFactory');
return widget;
}
}
protected createNewWidget(
context: DocumentRegistry.IContext
): IDocumentWidget {
const content = new ImageViewer(context);
const widget = new DocumentWidget({ content, context });
return widget;
}
}