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


TypeScript mode-tree.ModeTree类代码示例

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


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

示例1: beforeEach

 beforeEach(async () => {
   // We modify the default to have test-mode do its default behavior
   // which is to hide *some* attributes.
   const localOptions: Options = mergeOptions({}, options);
   localOptions.mode.submode!.mode.options!.hide_attributes = false;
   tree = new ModeTree(editor, localOptions.mode);
   await tree.init();
 });
开发者ID:lddubeau,项目名称:wed,代码行数:8,代码来源:mode-tree-test.ts

示例2: describe

  describe("#getAttributeHidingSpecs", () => {
    let tree: ModeTree;
    beforeEach(async () => {
      // We modify the default to have test-mode do its default behavior
      // which is to hide *some* attributes.
      const localOptions: Options = mergeOptions({}, options);
      localOptions.mode.submode!.mode.options!.hide_attributes = false;
      tree = new ModeTree(editor, localOptions.mode);
      await tree.init();
    });

    it("returns the right value for the top GUI node", () => {
      const handling = tree.getAttributeHidingSpecs(editor.guiRoot);
      expect(handling).to.be.null;
    });

    it("returns the right value for the top data node", () => {
      const handling = tree.getAttributeHidingSpecs(editor.guiRoot);
      expect(handling).to.be.null;
    });

    it("returns the right value for a GUI node governed by a submode", () => {
      const p = editor.guiRoot.querySelector(".p._real")!;
      const handling = tree.getAttributeHidingSpecs(p);
      expect(handling).to.not.be.null;
    });

    it("returns the right value for a data node governed by a submode", () => {
      const p = editor.dataRoot.querySelector("p")!;
      const handling = tree.getAttributeHidingSpecs(p);
      expect(handling).to.not.be.null;
    });
  });
开发者ID:lddubeau,项目名称:wed,代码行数:33,代码来源:mode-tree-test.ts

示例3: expect

 () => {
   const ps = editor.dataRoot.querySelectorAll("p");
   const opts = tree.getWedOptions(ps[0]);
   expect(opts).to.have.nested.property("metadata.name")
     .equal("Test1");
   for (const p of Array.from(ps)) {
     expect(opts).to.equal(tree.getWedOptions(p));
   }
 });
开发者ID:lddubeau,项目名称:wed,代码行数:9,代码来源:mode-tree-test.ts

示例4: it

 it("returns the same submode for nodes governed by same submode", () => {
   const ps = editor.dataRoot.querySelectorAll("p");
   const mode = tree.getMode(ps[0]);
   expect(mode.getWedOptions()).to.have.nested.property("metadata.name")
     .equal("Test1");
   for (const p of Array.from(ps)) {
     expect(mode).to.equal(tree.getMode(p));
   }
 });
开发者ID:lddubeau,项目名称:wed,代码行数:9,代码来源:mode-tree-test.ts


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