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 be set with type "markdown"', () => {
const model = new MarkdownCellModel({});
expect(model.type).to.equal('markdown');
});
});
it('should be set with type "markdown"', () => {
const model = new MarkdownCellModel({});
expect(model.type).to.equal('markdown');
});
});
describe('MarkdownCellWidget', () => {
let contentFactory = createBaseCellFactory();
let model = new MarkdownCellModel({});
describe('#constructor()', () => {
it('should create a markdown cell widget', () => {
let widget = new MarkdownCellWidget({ model, rendermime, contentFactory });
expect(widget).to.be.a(MarkdownCellWidget);
});
it('should accept a custom contentFactory', () => {
let widget = new MarkdownCellWidget({ model, rendermime, contentFactory });
expect(widget).to.be.a(MarkdownCellWidget);
});
it('should set the default mimetype to text/x-ipythongfm', () => {
let widget = new MarkdownCellWidget({ model, rendermime, contentFactory });
expect(widget.model.mimeType).to.be('text/x-ipythongfm');
it('should be set with type "markdown"', () => {
let model = new MarkdownCellModel({});
expect(model.type).to.be('markdown');
});
createMarkdownCell(options: CellModel.IOptions): IMarkdownCellModel {
if (this.modelDB) {
if (!options.id) {
options.id = UUID.uuid4();
}
options.modelDB = this.modelDB.view(options.id);
}
return new MarkdownCellModel(options);
}
private _createMarkdownCellOptions(text: string = ''): MarkdownCell.IOptions {
let contentFactory = this.contentFactory.markdownCellContentFactory;
let model = new MarkdownCellModel({ });
this._disposables.add(model);
let rendermime = this._rendermime;
model.value.text = text || '';
return { model, rendermime, contentFactory };
}
createMarkdownCell(options: CellModel.IOptions): IMarkdownCellModel {
if (this.modelDB) {
if (!options.id) {
options.id = UUID.uuid4();
}
options.modelDB = this.modelDB.view(options.id);
let cell;
this.modelDB.withTransaction(() => {
cell = new MarkdownCellModel(options);
});
return cell;
}
return new MarkdownCellModel(options);
}
private _createMarkdownCellOptions(text: string = ''): MarkdownCell.IOptions {
let contentFactory = this.contentFactory.markdownCellContentFactory;
let model = new MarkdownCellModel({ });
this._disposables.add(model);
let rendermime = this._rendermime;
model.value.text = text || '';
return { model, rendermime, contentFactory };
}