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 create a new widget given a document model and a context', () => {
const factory = createFactory();
const context = createFileContext();
const widget = factory.createNew(context);
expect(widget).to.be.an.instanceof(Widget);
});
it('should create a new widget given a document model and a context', () => {
const factory = createFactory();
const context = createFileContext();
const widget = factory.createNew(context);
expect(widget).to.be.an.instanceof(Widget);
});
});
it('should create an image document widget', () => {
const factory = new ImageViewerFactory({
name: 'Image',
modelName: 'base64',
fileTypes: ['png'],
defaultFor: ['png']
});
const context = createFileContext(IMAGE.path);
const d = factory.createNew(context);
expect(d).to.be.an.instanceof(DocumentWidget);
expect(d.content).to.be.an.instanceof(ImageViewer);
});
});
it('should create an image document widget', () => {
const factory = new ImageViewerFactory({
name: 'Image',
modelName: 'base64',
fileTypes: ['png'],
defaultFor: ['png']
});
const context = createFileContext(IMAGE.path);
const d = factory.createNew(context);
expect(d).to.be.an.instanceof(DocumentWidget);
expect(d.content).to.be.an.instanceof(ImageViewer);
});
});
it('should call createNew in default implementation', () => {
const factory = createFactory();
const context = createFileContext();
const widget = factory.createNew(context);
const clonedWidget: IDocumentWidget = factory.clone(widget, context);
expect(clonedWidget).to.not.equal(widget);
expect(clonedWidget.hasClass('WidgetFactory')).to.be.true;
expect(clonedWidget.context).to.equal(widget.context);
});
});
const setup = () => {
context = createFileContext(undefined, manager);
content = new Widget();
widget = new DocumentWidget({ context, content });
};
beforeEach(() => {
dContext = createFileContext();
});
beforeEach(() => {
dContext = createFileContext();
});
const setup = () => {
context = createFileContext(undefined, manager);
content = new Widget();
widget = new DocumentWidget({ context, content });
};