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.
25 lines
880 B
TypeScript
25 lines
880 B
TypeScript
import { QueryableNodes } from '@/presentation/components/Scripts/View/Tree/TreeView/TreeRoot/NodeCollection/Query/QueryableNodes';
|
|
import { TreeNodeCollection } from '@/presentation/components/Scripts/View/Tree/TreeView/TreeRoot/NodeCollection/TreeNodeCollection';
|
|
import { EventSourceStub } from './EventSourceStub';
|
|
import { QueryableNodesStub } from './QueryableNodesStub';
|
|
|
|
export class TreeNodeCollectionStub implements TreeNodeCollection {
|
|
public nodes: QueryableNodes = new QueryableNodesStub();
|
|
|
|
public nodesUpdated = new EventSourceStub<QueryableNodes>();
|
|
|
|
public updateRootNodes(): void {
|
|
throw new Error('Method not implemented.');
|
|
}
|
|
|
|
public withNodes(nodes: QueryableNodes): this {
|
|
this.nodes = nodes;
|
|
return this;
|
|
}
|
|
|
|
public triggerNodesUpdatedEvent(nodes: QueryableNodes): this {
|
|
this.nodesUpdated.notify(nodes);
|
|
return this;
|
|
}
|
|
}
|