Files
privacy.sexy/tests/unit/shared/Stubs/QueryableNodesStub.ts
undergroundwires 8f188acd3c Fix loss of tree node state when switching views
This commit fixes an issue where the check state of categories was lost
when toggling between card and tree views. This is solved by immediately
emitting node state changes for all nodes. This ensures consistent view
transitions without any loss of node state information.

Furthermore, this commit includes added unit tests for the modified code
sections.
2023-09-24 20:34:47 +02:00

29 lines
1.0 KiB
TypeScript

import { TreeNode } from '@/presentation/components/Scripts/View/Tree/TreeView/Node/TreeNode';
import { QueryableNodes } from '@/presentation/components/Scripts/View/Tree/TreeView/TreeRoot/NodeCollection/Query/QueryableNodes';
import { TreeNodeStub } from './TreeNodeStub';
export class QueryableNodesStub implements QueryableNodes {
public rootNodes: readonly TreeNode[] = [
new TreeNodeStub().withId(`[${QueryableNodesStub.name}] root-node-stub`),
];
public flattenedNodes: readonly TreeNode[] = [
new TreeNodeStub().withId(`[${QueryableNodesStub.name}] flattened-node-stub-1`),
new TreeNodeStub().withId(`[${QueryableNodesStub.name}] flattened-node-stub-2`),
];
public getNodeById(): TreeNode {
throw new Error('Method not implemented.');
}
public withRootNodes(rootNodes: readonly TreeNode[]): this {
this.rootNodes = rootNodes;
return this;
}
public withFlattenedNodes(flattenedNodes: readonly TreeNode[]): this {
this.flattenedNodes = flattenedNodes;
return this;
}
}