本文整理汇总了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));
}
});