Skip to content

Commit 6543783

Browse files
committed
test(*): add additional test for the LoadNextLevel feature; replace hasChildren property in test with the correct name
1 parent 1e4095d commit 6543783

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

test/tree.service.spec.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ describe('TreeService', () => {
256256
expect(treeService.nodeExpanded$.next).not.toHaveBeenCalled();
257257
});
258258

259-
it('fires "loadNextLevel" event when expanding node with hasChildren property set to true', () => {
259+
it('fires "loadNextLevel" event when expanding node with emitLoadNextLevel property set to true', () => {
260260
const masterTree = new Tree({
261261
value: 'Master',
262262
emitLoadNextLevel: true
@@ -350,7 +350,7 @@ describe('TreeService', () => {
350350
expect(treeService.loadNextLevel$.next).not.toHaveBeenCalled();
351351
});
352352

353-
it('not fires "loadNextLevel" event if "hasChildren" is false or does not exists', () => {
353+
it('not fires "loadNextLevel" event if "emitLoadNextLevel" does not exists', () => {
354354
const masterTree = new Tree({
355355
value: 'Master',
356356
});
@@ -364,5 +364,18 @@ describe('TreeService', () => {
364364
expect(treeService.loadNextLevel$.next).not.toHaveBeenCalled();
365365
});
366366

367+
it('not fires "loadNextLevel" event if "emitLoadNextLevel" is false', () => {
368+
const masterTree = new Tree({
369+
value: 'Master',
370+
emitLoadNextLevel: false
371+
});
367372

373+
masterTree.switchFoldingType();
374+
375+
spyOn(treeService.loadNextLevel$, 'next');
376+
377+
treeService.fireNodeSwitchFoldingType(masterTree);
378+
379+
expect(treeService.loadNextLevel$.next).not.toHaveBeenCalled();
380+
});
368381
});

0 commit comments

Comments
 (0)