• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

TypeScript codemirror.CodeMirrorEditorFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中@jupyterlab/codemirror.CodeMirrorEditorFactory的典型用法代码示例。如果您正苦于以下问题:TypeScript CodeMirrorEditorFactory类的具体用法?TypeScript CodeMirrorEditorFactory怎么用?TypeScript CodeMirrorEditorFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CodeMirrorEditorFactory类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: it

 it('should create a new editor with given options', () => {
   let factory = new CodeMirrorEditorFactory(options);
   let editor = factory.newDocumentEditor({host, model}) as CodeMirrorEditor;
   expect(editor).to.be.a(CodeMirrorEditor);
   for (let key in Object.keys(options)) {
     let option = key as keyof CodeMirrorEditor.IConfig;
     expect(editor.getOption(option)).to.equal(options[option]);
   }
   editor.dispose();
 });
开发者ID:7125messi,项目名称:jupyterlab,代码行数:10,代码来源:factory.spec.ts


示例2: it

 it('should create a new editor with given options', () => {
   let factory = new CodeMirrorEditorFactory(options);
   let editor = factory.newDocumentEditor({host, model});
   expect(editor).to.be.a(CodeMirrorEditor);
   let inner = (editor as CodeMirrorEditor).editor;
   for (let key of Object.keys(options)) {
     expect(inner.getOption(key)).to.equal((options as any)[key]);
   }
   editor.dispose();
 });
开发者ID:charnpreetsingh185,项目名称:jupyterlab,代码行数:10,代码来源:factory.spec.ts


示例3: describe

describe('editorwidget', () => {

  let factoryService = new CodeMirrorEditorFactory();
  let modelFactory = new TextModelFactory();
  let mimeTypeService = new CodeMirrorMimeTypeService();
  let context: DocumentRegistry.CodeContext;
  let manager: ServiceManager.IManager;

  before((done) => {
    manager = new ServiceManager();
    manager.ready.then(done, done);
  });

  describe('EditorWidget', () => {

    let widget: EditorWidget;

    beforeEach(() => {
      let path = utils.uuid() + '.py';
      context = new Context({ manager, factory: modelFactory, path });
      widget = new EditorWidget({
        factory: options => factoryService.newDocumentEditor(options),
        mimeTypeService,
        context
      });
    });

    afterEach(() => {
      widget.dispose();
    });

    describe('#constructor()', () => {

      it('should create an editor widget', () => {
        expect(widget).to.be.an(EditorWidget);
      });

      it('should update the editor text when the model changes', (done) => {
        context.save().catch(done);
        context.ready.then(() => {
          widget.context.model.fromString('foo');
          expect(widget.editor.model.value.text).to.be('foo');
        }).then(done, done);
      });

      it('should set the mime type for the path', () => {
        expect(widget.editor.model.mimeType).to.be('text/x-python');
      });

      it('should update the mime type when the path changes', (done) => {
        context.pathChanged.connect((sender, args) => {
          expect(widget.editor.model.mimeType).to.be('text/x-julia');
          done();
        });
        context.save().then(() => {
          return manager.contents.rename(context.path, utils.uuid() + '.jl');
        }).catch(done);
      });

      it('should set the title for the path', () => {
        expect(widget.title.label).to.be(context.path);
      });

      it('should add the dirty class when the model is dirty', (done) => {
        context.save().catch(done);
        context.ready.then(() => {
          context.model.fromString('bar');
          expect(widget.title.className).to.contain('jp-mod-dirty');
        }).then(done, done);
      });

      it('should update the title when the path changes', (done) => {
        let path = utils.uuid() + '.jl';
        context.pathChanged.connect((sender, args) => {
          expect(widget.title.label).to.be(path);
          done();
        });
        context.save().then(() => {
          return manager.contents.rename(context.path, path);
        }).catch(done);
      });

    });

    describe('#context', () => {

      it('should be the context used by the widget', () => {
        expect(widget.context).to.be(context);
      });

    });

  });

  describe('EditorWidgetFactory', () => {

    let widgetFactory = new EditorWidgetFactory({
      editorServices: {
        factoryService,
        mimeTypeService
//.........这里部分代码省略.........
开发者ID:faricacarroll,项目名称:jupyterlab,代码行数:101,代码来源:widget.spec.ts


示例4: it

 it('should create a new editor', () => {
   const factory = new CodeMirrorEditorFactory();
   const editor = factory.newDocumentEditor({ host, model });
   expect(editor).to.be.an.instanceof(CodeMirrorEditor);
   editor.dispose();
 });
开发者ID:afshin,项目名称:jupyterlab,代码行数:6,代码来源:factory.spec.ts


示例5:

 factory: options => factoryService.newDocumentEditor(options),
开发者ID:faricacarroll,项目名称:jupyterlab,代码行数:1,代码来源:widget.spec.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript codemirror.Mode类代码示例发布时间:2022-05-28
下一篇:
TypeScript codeeditor.CodeEditor.Model类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap