本文整理匯總了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();
});