本文整理汇总了TypeScript中@jupyterlab/rendermime.MimeModel类的典型用法代码示例。如果您正苦于以下问题:TypeScript MimeModel类的具体用法?TypeScript MimeModel怎么用?TypeScript MimeModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MimeModel类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should dispose of the resources used by the model', () => {
let model = new MimeModel();
model.dispose();
expect(model.isDisposed).to.be(true);
model.dispose();
expect(model.isDisposed).to.be(true);
});
示例2: describe
describe('rendermime/mimemodel', () => {
let model: MimeModel;
beforeEach(() => {
model = new MimeModel();
});
afterEach(() => {
model.dispose();
});
describe('MimeModel', () => {
describe('#constructor()', () => {
it('should create a new mime model', () => {
let model = new MimeModel();
expect(model).to.be.a(MimeModel);
});
it('should accept arguments', () => {
let model = new MimeModel({
data: { 'foo': 1},
trusted: true,
metadata: { 'bar': 'baz' }
});
expect(model).to.be.a(MimeModel);
});
});
describe('#trusted', () => {
it('should get the trusted state of the model', () => {
let model = new MimeModel();
expect(model.trusted).to.be(false);
model = new MimeModel({ trusted: true });
expect(model.trusted).to.be(true);
});
});
describe('#dispose()', () => {
it('should dispose of the resources used by the model', () => {
let model = new MimeModel();
model.dispose();
expect(model.isDisposed).to.be(true);
model.dispose();
expect(model.isDisposed).to.be(true);
});
});
describe('#data', () => {
it('should be the data observable map', () => {
let model = new MimeModel({
data: { 'bar': 'baz' }
});
expect(model.data.get('bar')).to.be('baz');
});
});
describe('#metadata', () => {
it('should be the metadata observable map', () => {
let model = new MimeModel({
metadata: { 'bar': 'baz' }
});
expect(model.metadata.get('bar')).to.be('baz');
});
});
describe('#toJSON()', () => {
it('should return the raw JSON values', () => {
let model = new MimeModel();
model.data.set('foo', 1);
model.metadata.set('bar', 'baz');
expect(JSONExt.deepEqual(model.toJSON(), {
trusted: false,
data: {'foo': 1 },
metadata: {'bar': 'baz'}
})).to.be(true);
});
});
});
});
示例3: afterEach
afterEach(() => {
model.dispose();
});