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