mirror of
https://github.com/google/blockly.git
synced 2026-01-09 10:00:09 +01:00
fix: Fix broken FocusManager tree unregistration.
This commit is contained in:
@@ -148,7 +148,7 @@ export class FocusManager {
|
||||
if (!this.isRegistered(tree)) {
|
||||
throw Error(`Attempted to unregister not registered tree: ${tree}.`);
|
||||
}
|
||||
const treeIndex = this.registeredTrees.findIndex((tree) => tree === tree);
|
||||
const treeIndex = this.registeredTrees.findIndex((reg) => reg === tree);
|
||||
this.registeredTrees.splice(treeIndex, 1);
|
||||
|
||||
const focusedNode = FocusableTreeTraverser.findFocusedNode(tree);
|
||||
|
||||
@@ -305,6 +305,18 @@ suite('FocusManager', function () {
|
||||
|
||||
assert.isTrue(isRegistered);
|
||||
});
|
||||
|
||||
test('for unregistered tree with other registered tree returns false', function () {
|
||||
this.focusManager.registerTree(this.testFocusableTree2);
|
||||
this.focusManager.registerTree(this.testFocusableTree1);
|
||||
this.focusManager.unregisterTree(this.testFocusableTree1);
|
||||
|
||||
const isRegistered = this.focusManager.isRegistered(
|
||||
this.testFocusableTree1,
|
||||
);
|
||||
|
||||
assert.isFalse(isRegistered);
|
||||
});
|
||||
});
|
||||
|
||||
suite('getFocusedTree()', function () {
|
||||
|
||||
Reference in New Issue
Block a user