Describe the bug
When node is unregistered then its overrides are cleaned as well, but if such node contains children that have overrides defined as well, than such overrides (those belonging to children) are not cleaned up.
To Reproduce
test('unregistering a node should unregister the overrides of its children', () => {
const navigation = new Lrud()
navigation.registerNode('root')
navigation.registerNode('a', { parent: 'root' })
navigation.registerNode('ab', { parent: 'a' })
navigation.registerNode('b', { parent: 'root' })
navigation.registerOverride('override_a', {
id: 'ab',
direction: 'right',
target: 'b'
})
navigation.unregister('a')
expect(navigation.overrides).toEqual({})
})
results with
FAIL src/unregister.test.js
● unregisterNode() › unregistering a node should unregister the overrides of its children
expect(received).toEqual(expected) // deep equality
- Expected - 1
+ Received + 7
- Object {}
+ Object {
+ "override_a": Object {
+ "direction": "right",
+ "id": "ab",
+ "target": "b",
+ },
+ }
| navigation.unregister('a')
|
> | expect(navigation.overrides).toEqual({})
| ^
| })
|
Expected behavior
Expected behavior is that all overrides related to unregistered node and its children should be cleaned up.
Describe the bug When node is unregistered then its overrides are cleaned as well, but if such node contains children that have overrides defined as well, than such overrides (those belonging to children) are not cleaned up.
To Reproduce
results with
Expected behavior Expected behavior is that all overrides related to unregistered node and its children should be cleaned up.
Screenshots No screenshots.
Additional context No additional context.