当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript rendermime.MimeModel类代码示例

本文整理汇总了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);
 });
开发者ID:charnpreetsingh185,项目名称:jupyterlab,代码行数:7,代码来源:mimemodel.spec.ts

示例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);
      });

    });

  });

});
开发者ID:charnpreetsingh185,项目名称:jupyterlab,代码行数:95,代码来源:mimemodel.spec.ts

示例3: afterEach

 afterEach(() => {
   model.dispose();
 });
开发者ID:charnpreetsingh185,项目名称:jupyterlab,代码行数:3,代码来源:mimemodel.spec.ts


注:本文中的@jupyterlab/rendermime.MimeModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。