本文整理汇总了TypeScript中vs/base/browser/ui/tree/indexTreeModel.IndexTreeModel.splice方法的典型用法代码示例。如果您正苦于以下问题:TypeScript IndexTreeModel.splice方法的具体用法?TypeScript IndexTreeModel.splice怎么用?TypeScript IndexTreeModel.splice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/base/browser/ui/tree/indexTreeModel.IndexTreeModel
的用法示例。
在下文中一共展示了IndexTreeModel.splice方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('deep delete', function () {
const list: ITreeNode<number>[] = [];
const model = new IndexTreeModel<number>(toSpliceable(list));
model.splice([0], 0, Iterator.fromArray([
{
element: 0, children: Iterator.fromArray([
{ element: 10 },
{ element: 11 },
{ element: 12 },
])
},
{ element: 1 },
{ element: 2 }
]));
assert.deepEqual(list.length, 6);
model.splice([0], 1);
assert.deepEqual(list.length, 2);
assert.deepEqual(list[0].element, 1);
assert.deepEqual(list[0].collapsed, false);
assert.deepEqual(list[0].depth, 1);
assert.deepEqual(list[1].element, 2);
assert.deepEqual(list[1].collapsed, false);
assert.deepEqual(list[1].depth, 1);
});
示例2: test
test('collapse', () => {
const list: ITreeNode<number>[] = [];
const model = new IndexTreeModel<number>(toSpliceable(list), -1);
model.splice([0], 0, Iterator.fromArray([
{
element: 0, children: Iterator.fromArray([
{ element: 10 },
{ element: 11 },
{ element: 12 },
])
},
{ element: 1 },
{ element: 2 }
]));
assert.deepEqual(list.length, 6);
model.setCollapsed([0], true);
assert.deepEqual(list.length, 3);
assert.deepEqual(list[0].element, 0);
assert.deepEqual(list[0].collapsed, true);
assert.deepEqual(list[0].depth, 1);
assert.deepEqual(list[1].element, 1);
assert.deepEqual(list[1].collapsed, false);
assert.deepEqual(list[1].depth, 1);
assert.deepEqual(list[2].element, 2);
assert.deepEqual(list[2].collapsed, false);
assert.deepEqual(list[2].depth, 1);
});