提交 eae37399 编写于 作者: J Joao Moreno

🐛 fixes #21096

上级 279a1110
......@@ -644,7 +644,7 @@ export class TreeNavigator implements INavigator<Item> {
if (!item) {
return null;
} else {
if (!item.isVisible() || !item.isExpanded() || item.lastChild === null) {
if (!(item instanceof RootItem) && (!item.isVisible() || !item.isExpanded() || item.lastChild === null)) {
return item;
} else {
return TreeNavigator.lastDescendantOf(item.lastChild);
......@@ -718,15 +718,7 @@ export class TreeNavigator implements INavigator<Item> {
}
public last(): Item {
if (this.start && this.start.isExpanded()) {
this.item = this.start.lastChild;
if (this.item && !this.item.isVisible()) {
this.previous();
}
}
return this.item || null;
return TreeNavigator.lastDescendantOf(this.start);
}
}
......
......@@ -556,6 +556,15 @@ suite('TreeModel - TreeNavigator', () => {
done();
});
});
test('last()', () => {
return model.setInput(SAMPLE.AB).then(() => {
return model.expandAll([{ id: 'a' }, { id: 'c' }]).then(() => {
const nav = model.getNavigator();
assert.equal(nav.last().id, 'cb');
});
});
});
});
suite('TreeModel - Expansion', () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册