當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。